Skip to content

Commit 9e59817

Browse files
committed
docs: add example for unset_gha_env
Signed-off-by: David van der Spek <[email protected]>
1 parent 266ea7e commit 9e59817

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,29 @@ steps:
265265
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
266266
```
267267

268+
#### unset_gha_env
269+
Setting this to true will unset the `GITHUB_ACTIONS` environment variable. This can be useful when wanting to validate things such as merging of a PR would create a valid release.
270+
271+
```yaml
272+
steps:
273+
- name: Checkout
274+
uses: actions/checkout@v4
275+
- name: Temporarily merge PR branch
276+
if: ${{ github.event_name == 'pull_request' }}
277+
run: |
278+
git config --global user.name github-actions
279+
git config --global user.email [email protected]
280+
git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "${{ github.event.pull_request.title }}"
281+
- name: Semantic Release
282+
uses: cycjimmy/semantic-release-action@v4
283+
with:
284+
unset_gha_env: ${{ github.event_name == 'pull_request' }}
285+
ci: ${{ github.event_name == 'pull_request' && false || '' }}
286+
env:
287+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
288+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
289+
```
290+
268291
### Outputs
269292
| Output Parameter | Description |
270293
|:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|

0 commit comments

Comments
 (0)