We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0c4c72 commit 6b7b13bCopy full SHA for 6b7b13b
1 file changed
.github/workflows/enforce-single-commit.yml
@@ -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