Skip to content

Commit 6ad6319

Browse files
authored
fix: restrict manual workflow dispatch to staging branch only (#64)
1 parent 3e953ee commit 6ad6319

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/staging-merge.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ jobs:
3030
with:
3131
fetch-depth: 0
3232

33+
- name: Validate manual trigger is on staging branch
34+
if: github.event_name == 'workflow_dispatch'
35+
shell: bash
36+
run: |
37+
set -euo pipefail
38+
39+
CURRENT_BRANCH="${GITHUB_REF##*/}"
40+
if [ "$CURRENT_BRANCH" != "staging" ]; then
41+
echo "❌ Error: Manual workflow dispatch is only allowed on 'staging' branch"
42+
echo " Current branch: $CURRENT_BRANCH"
43+
exit 1
44+
fi
45+
echo "✓ Manual trigger validated on staging branch"
46+
3347
- name: Check if push is from merged PR
3448
id: pr_merge_check
3549
uses: actions/github-script@v7

0 commit comments

Comments
 (0)