Skip to content

Commit fe23f9e

Browse files
kompreclaude
andcommitted
Change release workflow to trigger on push instead of pull_request
The pull_request:closed event wasn't triggering. Switch to push event which fires after PR is merged to main. Extract PR number from merge commit message to check for release labels. This should fix the automatic trigger issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5538f3a commit fe23f9e

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Release
22

33
on:
4-
pull_request:
5-
types: [closed]
4+
push:
65
branches: [main]
76
workflow_dispatch:
87
inputs:
@@ -13,7 +12,6 @@ on:
1312

1413
jobs:
1514
check-release-label:
16-
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
1715
runs-on: ubuntu-latest
1816
outputs:
1917
should-release: ${{ steps.check.outputs.release }}
@@ -27,11 +25,22 @@ jobs:
2725
env:
2826
GH_TOKEN: ${{ github.token }}
2927
run: |
30-
# Get PR number from event or input
28+
# Get PR number from event or commit message
3129
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
3230
PR_NUMBER=${{ inputs.pr_number }}
3331
else
34-
PR_NUMBER=${{ github.event.pull_request.number }}
32+
# Extract PR number from merge commit message
33+
COMMIT_MSG=$(git log -1 --pretty=%B)
34+
PR_NUMBER=$(echo "$COMMIT_MSG" | grep -oP '(?<=#)\d+(?=\))' | head -1)
35+
36+
if [ -z "$PR_NUMBER" ]; then
37+
echo "No PR number found in commit message, skipping release"
38+
echo "release=false" >> $GITHUB_OUTPUT
39+
echo "test=false" >> $GITHUB_OUTPUT
40+
exit 0
41+
fi
42+
43+
echo "Found PR number: $PR_NUMBER"
3544
fi
3645
3746
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name')

0 commit comments

Comments
 (0)