From d7ab7f2e6d94327ae2d60b2aa8feb7276609bb6f Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Tue, 19 Mar 2024 17:26:21 +0900 Subject: [PATCH 1/4] wip: modifiying --- action.yml | 3 +++ src/handleOptions.js | 15 +++++++++++++++ src/inputs.json | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e429a1a..45a53a8 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,9 @@ inputs: tag_format: required: false description: 'The default tag format on semantic-release is v{version}. You can override that behavior using this option.' + repository_url: + required: false + description: 'The Git repository url. If no repository url specified, current repository will be used by default.' outputs: new_release_published: description: 'Whether a new release was published' diff --git a/src/handleOptions.js b/src/handleOptions.js index 79c2ea5..b91b41e 100644 --- a/src/handleOptions.js +++ b/src/handleOptions.js @@ -116,3 +116,18 @@ exports.handleTagFormat = () => { return {}; } }; + +/** + * Handle repository-url Option + * @returns {{}|{r: String}} + */ +exports.handleRepositoryOption = () => { + const repositoryUrl = core.getInput(inputs.repository_url); + core.debug(`repository_url input: ${repository_url}`); + + if (repositoryUrl) { + return { r: repositoryUrl }; + } else { + return {}; + } +}; \ No newline at end of file diff --git a/src/inputs.json b/src/inputs.json index 55c4947..244af82 100644 --- a/src/inputs.json +++ b/src/inputs.json @@ -7,5 +7,6 @@ "ci": "ci", "extends": "extends", "working_directory": "working_directory", - "tag_format": "tag_format" + "tag_format": "tag_format", + "repository_url": "repository_url" } From 8dffec4efa886f02052787d688bfccb2e9983b1a Mon Sep 17 00:00:00 2001 From: mym0404 Date: Tue, 19 Mar 2024 17:29:33 +0900 Subject: [PATCH 2/4] feat: add repository_url input --- src/handleOptions.js | 2 +- src/index.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/handleOptions.js b/src/handleOptions.js index b91b41e..ed1a39a 100644 --- a/src/handleOptions.js +++ b/src/handleOptions.js @@ -123,7 +123,7 @@ exports.handleTagFormat = () => { */ exports.handleRepositoryOption = () => { const repositoryUrl = core.getInput(inputs.repository_url); - core.debug(`repository_url input: ${repository_url}`); + core.debug(`repository_url input: ${repositoryUrl}`); if (repositoryUrl) { return { r: repositoryUrl }; diff --git a/src/index.js b/src/index.js index faa9c1b..a4d2862 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ +import { handleRepositoryOption } from './handleOptions'; + const core = require('@actions/core'); const { handleBranchesOption, @@ -32,7 +34,8 @@ const release = async () => { ...handleDryRunOption(), ...handleCiOption(), ...handleExtends(), - ...handleTagFormat() + ...handleTagFormat(), + ...handleRepositoryOption() }); await cleanupNpmrc(); From a4cbd6ce3803e5342d0f1acc743c69c11dee5831 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Tue, 19 Mar 2024 17:32:17 +0900 Subject: [PATCH 3/4] docs: update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ea85eb..60c1952 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,8 @@ then make sure that you configure this in your `package.json` file: | ci | false | Whether to run semantic release with CI support. [[Details](#ci)]
Support for **semantic-release above v16**. | | extends | false | Use a sharable configuration [[Details](#extends)] | | working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] | -| tag_format | false | Specify format of tag (useful for monorepos) | +| tag_format | false | Specify format of tag (useful for monorepos) | +| repository_url | false | The Git repository url. If no repository url specified, current repository will be used by default. | #### semantic_version > {Optional Input Parameter} Specify version range for semantic-release. From f7e54f104770a7effe521e16cd4f0f7aa29bb01f Mon Sep 17 00:00:00 2001 From: mym0404 Date: Tue, 19 Mar 2024 17:33:17 +0900 Subject: [PATCH 4/4] refactor: rename handle repository url option function --- src/handleOptions.js | 2 +- src/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/handleOptions.js b/src/handleOptions.js index ed1a39a..829667f 100644 --- a/src/handleOptions.js +++ b/src/handleOptions.js @@ -121,7 +121,7 @@ exports.handleTagFormat = () => { * Handle repository-url Option * @returns {{}|{r: String}} */ -exports.handleRepositoryOption = () => { +exports.handleRepositoryUrlOption = () => { const repositoryUrl = core.getInput(inputs.repository_url); core.debug(`repository_url input: ${repositoryUrl}`); diff --git a/src/index.js b/src/index.js index a4d2862..095a5f8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import { handleRepositoryOption } from './handleOptions'; +import { handleRepositoryUrlOption } from './handleOptions'; const core = require('@actions/core'); const { @@ -35,7 +35,7 @@ const release = async () => { ...handleCiOption(), ...handleExtends(), ...handleTagFormat(), - ...handleRepositoryOption() + ...handleRepositoryUrlOption() }); await cleanupNpmrc();