From 9e59817a43971e5119709cc4b8f42b6c760132f2 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Tue, 11 Mar 2025 10:39:58 +0100 Subject: [PATCH] docs: add example for unset_gha_env Signed-off-by: David van der Spek --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index b10745a..14e7998 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,29 @@ steps: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} ``` +#### unset_gha_env +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. + +```yaml +steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Temporarily merge PR branch + if: ${{ github.event_name == 'pull_request' }} + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "${{ github.event.pull_request.title }}" + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + with: + unset_gha_env: ${{ github.event_name == 'pull_request' }} + ci: ${{ github.event_name == 'pull_request' && false || '' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +``` + ### Outputs | Output Parameter | Description | |:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|