File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 1111
1212jobs :
1313 check-main-override :
14- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
15- runs-on : ubuntu-latest
16- outputs :
17- bypassed : ${{ steps.override.outputs.bypassed }}
18- steps :
19- - name : 🛑 Prevent direct push to main without override
20- id : override
21- run : |
22- if [[ "${{ github.event.head_commit.message }}" == *"[override-main]"* ]]; then
23- echo "✅ Override flag found. Proceeding."
24- echo "bypassed=true" >> $GITHUB_OUTPUT
25- else
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : 🛑 Block direct pushes to main (unless override flag)
17+ run : |
18+ echo "🔍 Checking push context: ${{ github.event_name }} → ${{ github.ref }}"
19+ if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
20+ if [[ "${{ github.event.head_commit.message }}" != *"[override-main]"* ]]; then
2621 echo "❌ Direct push to main is blocked. Use a PR or include [override-main] in your commit message."
2722 exit 1
23+ else
24+ echo "✅ Override flag found. Allowing push to main."
2825 fi
26+ else
27+ echo "ℹ️ Not a direct push to main. Skipping protection."
28+ fi
2929
3030 lint :
3131 name : 🔍 Lint
You can’t perform that action at this time.
0 commit comments