Added GIT_DOMAIN env variable to override default domain (#133)

This commit is contained in:
Libor Krzyzanek 2021-03-15 10:13:58 +01:00 committed by GitHub
parent 2e4f8c2395
commit 111278e49f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -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` | | `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 | | `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 ## Keep up-to-date with GitHub Dependabot

3
dist/index.js generated vendored
View File

@ -253,6 +253,7 @@ function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const repo = core.getInput('repo') || process.env['GITHUB_REPOSITORY'] || ''; const repo = core.getInput('repo') || process.env['GITHUB_REPOSITORY'] || '';
const domain = process.env['GIT_DOMAIN'] || 'github.com';
const targetBranch = core.getInput('target_branch') || git.defaults.targetBranch; const targetBranch = core.getInput('target_branch') || git.defaults.targetBranch;
const keepHistory = /true/i.test(core.getInput('keep_history')); const keepHistory = /true/i.test(core.getInput('keep_history'));
const allowEmptyCommit = /true/i.test(core.getInput('allow_empty_commit')); const allowEmptyCommit = /true/i.test(core.getInput('allow_empty_commit'));
@ -279,7 +280,7 @@ function run() {
core.setFailed('You have to provide a GITHUB_TOKEN or GH_PAT'); core.setFailed('You have to provide a GITHUB_TOKEN or GH_PAT');
return; return;
} }
remoteURL = remoteURL.concat('@github.com/', repo, '.git'); remoteURL = remoteURL.concat('@', domain, '/', repo, '.git');
core.debug(`remoteURL=${remoteURL}`); core.debug(`remoteURL=${remoteURL}`);
const remoteBranchExists = yield git.remoteBranchExists(remoteURL, targetBranch); const remoteBranchExists = yield git.remoteBranchExists(remoteURL, targetBranch);
core.debug(`remoteBranchExists=${remoteBranchExists}`); core.debug(`remoteBranchExists=${remoteBranchExists}`);

View File

@ -9,6 +9,7 @@ import * as util from './util';
async function run() { async function run() {
try { try {
const repo: string = core.getInput('repo') || process.env['GITHUB_REPOSITORY'] || ''; 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 targetBranch: string = core.getInput('target_branch') || git.defaults.targetBranch;
const keepHistory: boolean = /true/i.test(core.getInput('keep_history')); const keepHistory: boolean = /true/i.test(core.getInput('keep_history'));
const allowEmptyCommit: boolean = /true/i.test(core.getInput('allow_empty_commit')); 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'); core.setFailed('You have to provide a GITHUB_TOKEN or GH_PAT');
return; return;
} }
remoteURL = remoteURL.concat('@github.com/', repo, '.git'); remoteURL = remoteURL.concat('@', domain, '/', repo, '.git');
core.debug(`remoteURL=${remoteURL}`); core.debug(`remoteURL=${remoteURL}`);
const remoteBranchExists: boolean = await git.remoteBranchExists(remoteURL, targetBranch); const remoteBranchExists: boolean = await git.remoteBranchExists(remoteURL, targetBranch);