File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Ensure no fixup! or amend! commits are present
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize, reopened]
6+
7+ jobs :
8+ check-forbidden-commits :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout code
12+ uses : actions/checkout@v6
13+
14+ - name : Fetch PR base and head
15+ run : |
16+ git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
17+ git fetch origin ${{ github.event.pull_request.head.ref }}:${{ github.event.pull_request.head.ref }}
18+
19+ - name : Check for fixup! or amend! commits
20+ run : |
21+ COMMITS=$(git log origin/${{ github.event.pull_request.base.ref }}..origin/${{ github.event.pull_request.head.ref }} --pretty=format:"%s")
22+ if echo "$COMMITS" | grep -E '^(fixup!|amend!)'; then
23+ echo "Error: PR contains fixup! or amend! commits. Please squash or rebase before merging."
24+ exit 1
25+ fi
You can’t perform that action at this time.
0 commit comments