Skip to content
Latchkey

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-action on PR edit and sync.
  • Mark items with (required) or use requireChecklist to require all.

PR template

.github/pull_request_template.md
## Checklist
- [ ] Tests added or updated (required)
- [ ] Docs updated (required)
- [ ] Changelog entry added

Workflow

.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: true

Gotchas

  • Trigger on edited so ticking a box re-runs the check without a new push.
  • Only lines containing (required) block merge unless requireChecklist is true.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →