Skip to content

Commit 8a81789

Browse files
author
rahul-infra
committed
fix(ci): Allow semantic-release to analyze PR merge commits
The release preview workflow was failing because semantic-release detected it was running on refs/pull/*/merge instead of the actual branch, causing it to skip release analysis. Changes: - Unset GITHUB_EVENT_NAME to remove pull_request context - Set GITHUB_EVENT_NAME=push to treat PR as push event - Add PR merge ref to allowed branches list This allows the preview to show what release version will be created.
1 parent cb382d4 commit 8a81789

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.github/workflows/release-preview.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ jobs:
4141
unset GITHUB_REF_NAME
4242
unset GITHUB_HEAD_REF
4343
unset GITHUB_BASE_REF
44+
unset GITHUB_EVENT_NAME
4445
4546
# Set them to what we want
4647
export GITHUB_REF="refs/heads/${{ github.event.pull_request.head.ref }}"
4748
export GITHUB_REF_NAME="${{ github.event.pull_request.head.ref }}"
49+
export GITHUB_EVENT_NAME="push"
4850
4951
# Run semantic-release with inline configuration using CLI options
5052
OUTPUT=$(npx --package semantic-release@${{ env.SEMANTIC_RELEASE_VERSION }} \
@@ -54,7 +56,8 @@ jobs:
5456
--dry-run \
5557
--no-ci \
5658
--debug \
57-
--branches ${{ github.event.pull_request.head.ref }} 2>&1 || true)
59+
--branches '${{ github.event.pull_request.head.ref }}' \
60+
--branches 'refs/pull/${{ github.event.pull_request.number }}/merge' 2>&1 || true)
5861
echo "$OUTPUT"
5962
6063
# Extract version information

0 commit comments

Comments
 (0)