From 863b06fd1cd7f36c1d74d697ddebe3cf5be4c6b0 Mon Sep 17 00:00:00 2001 From: Paavo Bennett Date: Mon, 11 Mar 2024 14:27:21 -0500 Subject: [PATCH] feat: add `changelog-host` input to `action.yml` (#948) This was originally part of [3.3.0](https://github.com/google-github-actions/release-please-action/blob/main/CHANGELOG.md#330-2022-08-10) (and fixed in [3.4.1](https://github.com/google-github-actions/release-please-action/blob/main/CHANGELOG.md#341-2022-08-24) to default to `github.server_url`). However, it was not part of 4.0.0. Without this input, you have to provide both config and manifest files in order to set the `changelog-host` option. With this input, you can simply provide `release-type` and `changelog-host` without the need for config and manifest files. Also, since it defaults to `github.server_url`, most users will not even have to set it. Signed-off-by: Paavo Bennett Co-authored-by: Jeff Ching --- action.yml | 4 ++++ src/index.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4ab8e53..f2775e1 100644 --- a/action.yml +++ b/action.yml @@ -58,6 +58,10 @@ inputs: description: 'if set to true, then do not try to open pull requests' required: false default: false + changelog-host: + description: 'The proto://host where commits live. Default `https://github.com`' + required: false + default: ${{ github.server_url }} runs: using: 'node20' main: 'dist/index.js' diff --git a/src/index.ts b/src/index.ts index 7790eeb..3e82f8f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,7 @@ const DEFAULT_CONFIG_FILE = 'release-please-config.json'; const DEFAULT_MANIFEST_FILE = '.release-please-manifest.json'; const DEFAULT_GITHUB_API_URL = 'https://api.github.com'; const DEFAULT_GITHUB_GRAPHQL_URL = 'https://api.github.com'; +const DEFAULT_GITHUB_SERVER_URL = 'https://github.com'; interface Proxy { host: string; @@ -40,6 +41,7 @@ interface ActionInputs { skipGitHubPullRequest?: boolean; fork?: boolean; includeComponentInTag?: boolean; + changelogHost: string; } function parseInputs(): ActionInputs { @@ -60,6 +62,7 @@ function parseInputs(): ActionInputs { skipGitHubPullRequest: getOptionalBooleanInput('skip-github-pull-request'), fork: getOptionalBooleanInput('fork'), includeComponentInTag: getOptionalBooleanInput('include-component-in-tag'), + changelogHost: core.getInput('changelog-host') || DEFAULT_GITHUB_SERVER_URL, }; return inputs; } @@ -88,6 +91,7 @@ function loadOrBuildManifest( { releaseType: inputs.releaseType, includeComponentInTag: inputs.includeComponentInTag, + changelogHost: inputs.changelogHost, }, { fork: inputs.fork, @@ -205,4 +209,4 @@ if (require.main === module) { main().catch(err => { core.setFailed(`release-please failed: ${err.message}`) }) -} \ No newline at end of file +}