Skip to content

Commit dda4571

Browse files
strubfdupress
authored andcommitted
ci: enforce single-commit PRs
1 parent b0c4c72 commit dda4571

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)