diff --git a/lib/main.js b/lib/main.js index 3638166..ec0cbf0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -56,21 +56,20 @@ function run() { ]); let gitURL = String('https://'); if (process.env['GITHUB_PAT']) { - gitURL.concat(process.env['GITHUB_PAT']); + gitURL = gitURL.concat(process.env['GITHUB_PAT']); } else if (process.env['GITHUB_TOKEN']) { - gitURL.concat('x-access-token:', process.env['GITHUB_TOKEN']); + gitURL = gitURL.concat('x-access-token:', process.env['GITHUB_TOKEN']); } else { core.setFailed('❌️ You have to provide a GITHUB_TOKEN or GITHUB_PAT'); return; } - gitURL.concat('@github.com/', repo, '.git'); yield exec.exec('git', [ 'push', '--force', '--quiet', - gitURL, + gitURL.concat('@github.com/', repo, '.git'), `master:${target_branch}` ]); process.chdir(process.env['GITHUB_WORKSPACE'] || '.'); diff --git a/src/main.ts b/src/main.ts index 2d7e06f..98f521d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,19 +46,18 @@ async function run() { let gitURL = String('https://'); if (process.env['GITHUB_PAT']) { - gitURL.concat(process.env['GITHUB_PAT']); + gitURL = gitURL.concat(process.env['GITHUB_PAT']); } else if (process.env['GITHUB_TOKEN']) { - gitURL.concat('x-access-token:', process.env['GITHUB_TOKEN']); + gitURL = gitURL.concat('x-access-token:', process.env['GITHUB_TOKEN']); } else { core.setFailed('❌️ You have to provide a GITHUB_TOKEN or GITHUB_PAT'); return; } - gitURL.concat('@github.com/', repo, '.git'); await exec.exec('git', [ 'push', '--force', '--quiet', - gitURL, + gitURL.concat('@github.com/', repo, '.git'), `master:${target_branch}` ]);