Skip to content

Commit 8a49879

Browse files
committed
feat: add ability to unset GITHUB_ACTION env var
Signed-off-by: David van der Spek <[email protected]>
1 parent fbe9698 commit 8a49879

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ then make sure that you configure this in your `package.json` file:
5151
| extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
5252
| dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
5353
| ci | false | Whether to run semantic release with CI support. [[Details](#ci)]<br>Support for **semantic-release above v16**. |
54+
| unset_gha_env | false | Whether to unset the GITHUB_ACTIONS environment variable. |
5455
| extends | false | Use a sharable configuration [[Details](#extends)] |
5556
| working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
5657
| tag_format | false | Specify format of tag (useful for monorepos) |

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ inputs:
2323
ci:
2424
required: false
2525
description: 'Whether to run semantic release with CI support (default: true). It will override the ci attribute in your configuration file'
26+
unset_gha_env:
27+
required: false
28+
description: 'Whether to unset the GITHUB_ACTIONS environment variable. This can be useful when trying to run semantic-release as part of PR checks.'
2629
extends:
2730
required: false
2831
description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'

src/handleOptions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ exports.handleRepositoryUrlOption = () => {
126126
core.debug(`repository_url input: ${repositoryUrl}`);
127127

128128
if (repositoryUrl) {
129-
return { r: repositoryUrl };
129+
return { r: repositoryUrl };
130130
} else {
131131
return {};
132132
}
133-
};
133+
};

src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const release = async () => {
2727
await preInstall(core.getInput(inputs.extra_plugins));
2828
await preInstall(core.getInput(inputs.extends));
2929

30+
if (core.getInput(inputs.unset_gha_env) === 'true') {
31+
core.debug('Unset GITHUB_ACTIONS environment variable');
32+
delete process.env.GITHUB_ACTIONS;
33+
}
34+
3035
const semanticRelease = await import('semantic-release');
3136
const result = await semanticRelease.default({
3237
...handleBranchesOption(),

src/inputs.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"extra_plugins": "extra_plugins",
66
"dry_run": "dry_run",
77
"ci": "ci",
8+
"unset_gha_env": "unset_gha_env",
89
"extends": "extends",
910
"working_directory": "working_directory",
1011
"tag_format": "tag_format",

0 commit comments

Comments
 (0)