From fd7f2fff26a5ad2654f5f5dc574fd7818f46daec Mon Sep 17 00:00:00 2001 From: Neo Hsu Date: Fri, 24 Sep 2021 05:37:49 +0800 Subject: [PATCH] feat(input): add github API URL configuration for input (#368) --- README.md | 1 + index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 52010bd..507bbfd 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Automate releases with Conventional Commit Messages. | `default-branch` | branch to open pull release PR against (detected by default) | | `pull-request-title-pattern` | title pattern used to make release PR, defaults to using `chore${scope}: release${component} ${version}`. | | `changelog-path` | configure alternate path for `CHANGELOG.md`. Default `CHANGELOG.md` | +| `github-api-url` | configure github API URL. Default `https://api.github.com` | | output | description | |:---:|---| diff --git a/index.js b/index.js index d3d7fe7..f0cc564 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,7 @@ const MANIFEST_COMMANDS = ['manifest', 'manifest-pr'] const RELEASE_LABEL = 'autorelease: pending' const GITHUB_RELEASE_COMMAND = 'github-release' const GITHUB_RELEASE_PR_COMMAND = 'release-pr' +const GITHUB_API_URL = 'https://api.github.com' function getBooleanInput (input) { const trueValue = ['true', 'True', 'TRUE', 'yes', 'Yes', 'YES', 'y', 'Y', 'on', 'On', 'ON'] @@ -22,7 +23,7 @@ function getGitHubInput () { fork: getBooleanInput('fork'), defaultBranch: core.getInput('default-branch') || undefined, repoUrl: process.env.GITHUB_REPOSITORY, - apiUrl: 'https://api.github.com', + apiUrl: core.getInput('github-api-url') || GITHUB_API_URL, token: core.getInput('token', { required: true }) } }