From ad0652f7a2e64c322ac3163dcec09ab5872fec92 Mon Sep 17 00:00:00 2001 From: Asheesh Dwivedi Date: Sat, 26 Mar 2022 22:11:03 -0400 Subject: [PATCH] chore:add-support-for-private-repo --- action.yml | 5 +++++ src/helpers/git.js | 3 ++- src/index.js | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a67bad6..d74dcb0 100644 --- a/action.yml +++ b/action.yml @@ -108,6 +108,11 @@ inputs: description: 'Path to the pre-changelog-generation script file' required: false + git-url: + description: 'Git Url' + default: 'github.com' + required: false + outputs: changelog: diff --git a/src/helpers/git.js b/src/helpers/git.js index b35cf0c..9a58399 100644 --- a/src/helpers/git.js +++ b/src/helpers/git.js @@ -18,6 +18,7 @@ module.exports = new (class Git { const gitUserName = core.getInput('git-user-name') const gitUserEmail = core.getInput('git-user-email') + const gitUrl = core.getInput('git-url') // if the env is dont-use-git then we mock exec as we are testing a workflow if (ENV === 'dont-use-git') { @@ -38,7 +39,7 @@ module.exports = new (class Git { // Update the origin if (githubToken) { - this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`) + this.updateOrigin(`https://x-access-token:${githubToken}@${gitUrl}/${GITHUB_REPOSITORY}.git`) } } diff --git a/src/index.js b/src/index.js index 2220c0f..8c266ba 100644 --- a/src/index.js +++ b/src/index.js @@ -42,6 +42,7 @@ async function run() { const skipEmptyRelease = core.getInput('skip-on-empty').toLowerCase() === 'true' const conventionalConfigFile = core.getInput('config-file-path') const preChangelogGenerationFile = core.getInput('pre-changelog-generation') + const gitUrl = core.getInput('git-url') core.info(`Using "${preset}" preset`) core.info(`Using "${gitCommitMessage}" as commit message`) @@ -53,6 +54,7 @@ async function run() { core.info(`Using "${tagPrefix}" as tag prefix`) core.info(`Using "${outputFile}" as output file`) core.info(`Using "${conventionalConfigFile}" as config file`) + core.info(`Using "${gitUrl}" as gitUrl`) if (preCommitFile) { core.info(`Using "${preCommitFile}" as pre-commit script`)