From eef7fed529ff8024b6cffe9f69d9598c8450a4ff Mon Sep 17 00:00:00 2001 From: Libor Krzyzanek Date: Thu, 4 Feb 2021 12:29:05 +0100 Subject: [PATCH] Added GIT_DOMAIN env variable to override default domain --- README.md | 1 + src/main.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c283e8d6b54..158a46ead43 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ Following environment variables can be used as `step.env` keys |----------------|---------------------------------------| | `GITHUB_TOKEN` | [GITHUB_TOKEN](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) as provided by `secrets` | | `GH_PAT` | Use a [Personal Access Token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) if you want to deploy to another repo | +| `GIT_DOMAIN` | Use another domain. Default `github.com` | ## Keep up-to-date with GitHub Dependabot diff --git a/src/main.ts b/src/main.ts index e06d4122490..7ff1676acbd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,6 +9,7 @@ import * as util from './util'; async function run() { try { const repo: string = core.getInput('repo') || process.env['GITHUB_REPOSITORY'] || ''; + const domain: string = process.env['GIT_DOMAIN'] || 'github.com'; const targetBranch: string = core.getInput('target_branch') || git.defaults.targetBranch; const keepHistory: boolean = /true/i.test(core.getInput('keep_history')); const allowEmptyCommit: boolean = /true/i.test(core.getInput('allow_empty_commit')); @@ -35,7 +36,7 @@ async function run() { core.setFailed('You have to provide a GITHUB_TOKEN or GH_PAT'); return; } - remoteURL = remoteURL.concat('@github.com/', repo, '.git'); + remoteURL = remoteURL.concat('@', domain, '/', repo, '.git'); core.debug(`remoteURL=${remoteURL}`); const remoteBranchExists: boolean = await git.remoteBranchExists(remoteURL, targetBranch);