Skip to content

Commit 1aff67c

Browse files
pditommasoclaude
andcommitted
Fix release condition with explicit check job
- Add check_release job to properly evaluate [release] condition - Use bash string matching instead of GitHub expressions - Make release job depend on both build success and release check - This prevents unintended releases when [release] is not in commit message 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 789a7e4 commit 1aff67c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,24 @@ jobs:
1212
build:
1313
uses: ./.github/workflows/build.yml
1414

15-
release:
15+
check_release:
1616
needs: build
17-
if: github.ref == 'refs/heads/master' && contains(join(github.event.commits.*.message, ' '), '[release]')
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should_release: ${{ steps.check.outputs.should_release }}
20+
steps:
21+
- name: Check if release is needed
22+
id: check
23+
run: |
24+
if [[ "${{ github.ref }}" == "refs/heads/master" ]] && [[ "${{ github.event.head_commit.message }}" == *"[release]"* ]]; then
25+
echo "should_release=true" >> $GITHUB_OUTPUT
26+
else
27+
echo "should_release=false" >> $GITHUB_OUTPUT
28+
fi
29+
30+
release:
31+
needs: [build, check_release]
32+
if: needs.check_release.outputs.should_release == 'true'
1833
uses: ./.github/workflows/release.yml
1934
with:
2035
should_release: true

0 commit comments

Comments
 (0)