Skip to content

Commit 6b7b13b

Browse files
committed
ci: enforce single-commit PRs
1 parent b0c4c72 commit 6b7b13b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Enforce single-commit PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
check-commit-count:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Verify PR has exactly one commit
12+
env:
13+
COMMITS: ${{ github.event.pull_request.commits }}
14+
run: |
15+
echo "PR contains $COMMITS commit(s)."
16+
if [ "$COMMITS" -ne 1 ]; then
17+
echo "::error::This PR has $COMMITS commits. Please squash to a single commit."
18+
exit 1
19+
fi
20+
echo "OK: PR has exactly 1 commit."

0 commit comments

Comments
 (0)