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 ability to unset GITHUB_ACTION env var #225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ then make sure that you configure this in your `package.json` file:
| extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
| dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
| ci | false | Whether to run semantic release with CI support. [[Details](#ci)]<br>Support for **semantic-release above v16**. |
| unset_gha_env | false | Whether to unset the GITHUB_ACTIONS environment variable. |
| 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) |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
ci:
required: false
description: 'Whether to run semantic release with CI support (default: true). It will override the ci attribute in your configuration file'
unset_gha_env:
required: false
description: 'Whether to unset the GITHUB_ACTIONS environment variable. This can be useful when trying to run semantic-release as part of PR checks.'
extends:
required: false
description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'
Expand Down
4 changes: 2 additions & 2 deletions src/handleOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ exports.handleRepositoryUrlOption = () => {
core.debug(`repository_url input: ${repositoryUrl}`);

if (repositoryUrl) {
return { r: repositoryUrl };
return { r: repositoryUrl };
} else {
return {};
}
};
};
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const release = async () => {
await preInstall(core.getInput(inputs.extra_plugins));
await preInstall(core.getInput(inputs.extends));

if (core.getInput(inputs.unset_gha_env) === 'true') {
core.debug('Unset GITHUB_ACTIONS environment variable');
delete process.env.GITHUB_ACTIONS;
}

const semanticRelease = await import('semantic-release');
const result = await semanticRelease.default({
...handleBranchesOption(),
Expand Down
1 change: 1 addition & 0 deletions src/inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"extra_plugins": "extra_plugins",
"dry_run": "dry_run",
"ci": "ci",
"unset_gha_env": "unset_gha_env",
"extends": "extends",
"working_directory": "working_directory",
"tag_format": "tag_format",
Expand Down
Loading