Skip to content

Commit 9a7900b

Browse files
feat: pr checklist
1 parent 57c8ff8 commit 9a7900b

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/pull_request_template.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Checklist
2+
3+
- [ ] I have tested the changes in both light and dark mode.
4+
- [ ] I have run all unit tests and ensured they pass.
5+
- [ ] I have considered the need for new unit tests.
6+
- [ ] I have tested the changes on a cluster.
7+
- [ ] I have included relevant documentation updates.
8+
- [ ] I have an approved Figma design or have reflected my changes in Figma
9+
- [ ] I have verified that the UI/UX is consistent in major browsers (e.g., Chrome, Firefox, Safari, Edge).
10+
- [ ] I have tested the changes on mobile devices or simulators to ensure responsiveness.
11+
- [ ] I have tested expected error states and verified that the user is presented with informative error messages.
12+
- [ ] I have tested the feature with unusual or extreme inputs (e.g., very long strings, empty states, clicking a button multiple times quickly).

.github/workflows/checklist.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Enforce Checklist
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
check-checklist:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out repository
12+
uses: actions/checkout@v2
13+
14+
- name: Get PR details
15+
id: pr
16+
uses: actions-ecosystem/action-get-PR-info@v1
17+
with:
18+
github_token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Validate Checklist
21+
run: |
22+
PR_BODY="${{ steps.pr.outputs.body }}"
23+
24+
# 1. Check for "## Checklist" section
25+
if ! echo "$PR_BODY" | grep -q "^## Checklist"; then
26+
echo "No '## Checklist' section found in the PR description."
27+
exit 1
28+
fi
29+
30+
# 2. Check that there is at least one checkbox line ('- [ ]' or '- [x]')
31+
# We'll consider any line that starts with '- [' as a checklist item.
32+
CHECKBOX_COUNT=$(echo "$PR_BODY" | grep "^- \[" | wc -l)
33+
if [ "$CHECKBOX_COUNT" -eq 0 ]; then
34+
echo "No checklist items found under '## Checklist'."
35+
exit 1
36+
fi
37+
38+
# 3. Ensure all checkbox items are ticked (i.e., no '- [ ]' remain).
39+
UNCHECKED_COUNT=$(echo "$PR_BODY" | grep "^- \[ \]" | wc -l)
40+
if [ "$UNCHECKED_COUNT" -gt 0 ]; then
41+
echo "Not all checklist items are checked. Please tick all boxes."
42+
exit 1
43+
fi
44+
45+
echo "All checks passed. The checklist is present and fully checked."

0 commit comments

Comments
 (0)