This commit is contained in:
Alexander Mirgorod 2024-09-30 18:14:06 +03:00
parent bc466c9b3a
commit 7ee7a7300f
2 changed files with 6 additions and 4 deletions

5
dist/index.js vendored
View file

@ -341,7 +341,8 @@ const crypto = __webpack_require__(417);
const { homePath, sshAgentCmdDefault, sshAddCmdDefault, gitCmdDefault } = __webpack_require__(972); const { homePath, sshAgentCmdDefault, sshAddCmdDefault, gitCmdDefault } = __webpack_require__(972);
try { try {
const instanceDomain = core.getInput('instance-domain', {default: 'github.com'}); const instanceURL = core.getInput('instance-url') || process.env.GITHUB_SERVER_URL || 'https://github.com';
const instanceDomain = instanceURL.replace(/^https?:\/\//, '');
const escapedDomain = instanceDomain.replace(/[-.]/g, '\\$&'); const escapedDomain = instanceDomain.replace(/[-.]/g, '\\$&');
const regexDomain = new RegExp(`\\b${escapedDomain}[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)`, 'i'); const regexDomain = new RegExp(`\\b${escapedDomain}[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)`, 'i');
@ -394,7 +395,7 @@ try {
console.log('Configuring deployment key(s)'); console.log('Configuring deployment key(s)');
child_process.execFileSync(sshAddCmd, ['-L']).toString().trim().split(/\r?\n/).forEach(function(key) { child_process.execFileSync(sshAddCmd, ['-L']).toString().trim().split(/\r?\n/).forEach(function(key) {
console.log('Domain regular expression is:', regexDomain); console.log('Instance domain is:', instanceDomain);
const parts = key.match(regexDomain); const parts = key.match(regexDomain);
if (!parts) { if (!parts) {

View file

@ -5,7 +5,8 @@ const crypto = require('crypto');
const { homePath, sshAgentCmdDefault, sshAddCmdDefault, gitCmdDefault } = require('./paths.js'); const { homePath, sshAgentCmdDefault, sshAddCmdDefault, gitCmdDefault } = require('./paths.js');
try { try {
const instanceDomain = core.getInput('instance-domain', {default: 'github.com'}); const instanceURL = core.getInput('instance-url') || process.env.GITHUB_SERVER_URL || 'https://github.com';
const instanceDomain = instanceURL.replace(/^https?:\/\//, '');
const escapedDomain = instanceDomain.replace(/[-.]/g, '\\$&'); const escapedDomain = instanceDomain.replace(/[-.]/g, '\\$&');
const regexDomain = new RegExp(`\\b${escapedDomain}[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)`, 'i'); const regexDomain = new RegExp(`\\b${escapedDomain}[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)`, 'i');
@ -58,7 +59,7 @@ try {
console.log('Configuring deployment key(s)'); console.log('Configuring deployment key(s)');
child_process.execFileSync(sshAddCmd, ['-L']).toString().trim().split(/\r?\n/).forEach(function(key) { child_process.execFileSync(sshAddCmd, ['-L']).toString().trim().split(/\r?\n/).forEach(function(key) {
console.log('Domain regular expression is:', regexDomain); console.log('Instance domain is:', instanceDomain);
const parts = key.match(regexDomain); const parts = key.match(regexDomain);
if (!parts) { if (!parts) {