How to Enforce a PR Body Checklist
A checklist action scans the PR body for unchecked boxes and fails the run until each required item is ticked.
Add a Markdown checklist to your pull request template, then run mheap/require-checklist-action on pull_request edited and synchronize events to fail while any required box is unchecked.
Steps
- Add checkboxes to
.github/pull_request_template.md. - Run
mheap/require-checklist-actionon PR edit and sync. - Mark items with
(required)or userequireChecklistto require all.
PR template
.github/pull_request_template.md
## Checklist
- [ ] Tests added or updated (required)
- [ ] Docs updated (required)
- [ ] Changelog entry addedWorkflow
.github/workflows/ci.yml
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
checklist:
runs-on: ubuntu-latest
steps:
- uses: mheap/require-checklist-action@v2
with:
requireChecklist: trueGotchas
- Trigger on
editedso ticking a box re-runs the check without a new push. - Only lines containing
(required)block merge unlessrequireChecklistis true.
Related guides
How to Require Conventional Commit PR TitlesEnforce a Conventional Commits format on pull request titles with amannn/action-semantic-pull-request, failin…
How to Require a Linked Issue on a Pull RequestFail a pull request that does not reference an issue by scanning the PR body for a closing keyword with actio…