Skip to content

Commit a4c3b19

Browse files
committed
CI: add PR hygiene checks using dannywillems/toolbox
Add pr-hygiene workflow that downloads scripts from the toolbox repository: - check-pr-size.sh: warn at 300 lines, fail at 500 - check-title-length.sh: commit titles <= 80 chars - check-no-fixup.sh: no fixup/squash/WIP commits - check-commit-body.sh: body required for 20+ line changes Closes #77
1 parent 37f496c commit a4c3b19

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/pr-hygiene.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: PR hygiene checks
2+
on:
3+
pull_request:
4+
types: [assigned, opened, synchronize, reopened]
5+
branches:
6+
- main
7+
merge_group:
8+
types: [checks_requested]
9+
10+
jobs:
11+
check-pr-size:
12+
name: Check PR size
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
- name: Download script
19+
run: |
20+
curl -sSLO \
21+
"https://raw.githubusercontent.com/dannywillems/toolbox/main/pr-hygiene/check-pr-size.sh"
22+
chmod +x check-pr-size.sh
23+
- name: Check PR size
24+
run: >
25+
./check-pr-size.sh
26+
"${{ github.event.pull_request.base.sha }}"
27+
28+
check-commit-messages:
29+
name: Check commit messages
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v6
33+
with:
34+
fetch-depth: 0
35+
- name: Download scripts
36+
run: |
37+
for script in check-title-length.sh \
38+
check-no-fixup.sh check-commit-body.sh; do
39+
curl -sSLO \
40+
"https://raw.githubusercontent.com/dannywillems/toolbox/main/pr-hygiene/${script}"
41+
chmod +x "${script}"
42+
done
43+
- name: Check title length
44+
run: >
45+
./check-title-length.sh
46+
"${{ github.event.pull_request.base.sha }}"
47+
- name: Check no fixup/WIP commits
48+
run: >
49+
./check-no-fixup.sh
50+
"${{ github.event.pull_request.base.sha }}"
51+
- name: Check commit body on large changes
52+
run: >
53+
./check-commit-body.sh
54+
"${{ github.event.pull_request.base.sha }}"

0 commit comments

Comments
 (0)