Skip to content

Commit 42a65db

Browse files
MarTrepodiclaude
andcommitted
ci(release): guard release workflow against non-main dispatch
Add if: github.ref == 'refs/heads/main' to both jobs in release.yml so that an accidental workflow_dispatch from develop or a feature branch exits without bumping the version, tagging, or publishing. The guard goes on each job (not at workflow level) because workflow-level if: is not valid for workflow_dispatch. Trigger remains workflow_dispatch:. The review document suggested migrating to tag-based push triggers, but this workflow creates the tag itself, so reacting to its own tag would be circular. Dispatch with a hard branch guard is the right pattern here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 211494a commit 42a65db

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
release:
88
name: Semantic Release
99
runs-on: ubuntu-latest
10+
if: github.ref == 'refs/heads/main'
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-release-${{ github.ref_name }}
@@ -70,6 +71,7 @@ jobs:
7071
# Publish the package to PyPI
7172
pypi-publish:
7273
runs-on: ubuntu-latest
74+
if: github.ref == 'refs/heads/main'
7375
needs:
7476
- release
7577
permissions:

0 commit comments

Comments
 (0)