Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add repository_url input #198

Merged
merged 4 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]<br>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.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
15 changes: 15 additions & 0 deletions src/handleOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,18 @@ exports.handleTagFormat = () => {
return {};
}
};

/**
* Handle repository-url Option
* @returns {{}|{r: String}}
*/
exports.handleRepositoryUrlOption = () => {
const repositoryUrl = core.getInput(inputs.repository_url);
core.debug(`repository_url input: ${repositoryUrl}`);

if (repositoryUrl) {
return { r: repositoryUrl };
} else {
return {};
}
};
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { handleRepositoryUrlOption } from './handleOptions';

const core = require('@actions/core');
const {
handleBranchesOption,
Expand Down Expand Up @@ -32,7 +34,8 @@ const release = async () => {
...handleDryRunOption(),
...handleCiOption(),
...handleExtends(),
...handleTagFormat()
...handleTagFormat(),
...handleRepositoryUrlOption()
});

await cleanupNpmrc();
Expand Down
3 changes: 2 additions & 1 deletion src/inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"ci": "ci",
"extends": "extends",
"working_directory": "working_directory",
"tag_format": "tag_format"
"tag_format": "tag_format",
"repository_url": "repository_url"
}