# I got tired of repeating myself on pull requests, so I built a tiny rule-based gatekeeper

> Source: <https://dev.to/havertz2/i-got-tired-of-repeating-myself-on-pull-requests-so-i-built-a-tiny-rule-based-gatekeeper-2452>
> Published: 2026-12-01 03:09:42+00:00

**Key takeaway:** contrib-gate enforces PR hygiene with regex and glob matching instead of an LLM, checking linked issues, tests, diff size and an 'AI assistance: yes/no' disclosure line, and updating one comment in place rather than stacking new ones.

Every maintainer knows the loop. A new pull request comes in, and you type the same comments again: please link the issue, please add tests with that source change, please keep the diff small enough to review.

Recently a fourth line joined the list: was this written by AI?

I don't like that question as a vibe check. AI-detection tools flag real newcomers and miss fluent generated code, and accusing a first-time contributor of being a bot is a good way to never see them again. But I do think contributors should say whether they used AI, the same way they say what they changed. So instead of detecting, I made disclosure one of the house rules - and then automated the reminding.

[contrib-gate](https://github.com/Havertz2/contrib-gate) is a GitHub Action (also a CLI) that checks each pull request against your repo's contribution rules and posts one polite checklist comment. It is deliberately boring technology: regular expressions and glob matching, one JavaScript file, zero dependencies, no LLM calls, no paid services.

It checks four things:

`Fixes #123`). Optionally, the linked issue must carry a maintainer's label like `accepted`, so drive-by PRs for unwanted features get caught early.` AI assistance: yes` or `AI assistance: no`. A PR template makes this a two-second habit.
When something fails, the comment says exactly how to fix it, one line per check. When the contributor pushes again or edits the description, the same comment updates in place instead of stacking new ones.

AI code review tools are everywhere now, and some are genuinely useful. For this job I wanted determinism:

The flip side is honesty about scope: contrib-gate checks the *contribution*, not the code. It will not tell you whether the diff is good. It makes sure the PR is reviewable - linked, tested, disclosed, and small - before a human spends time on it.

```
name: contrib-gate
on:
  pull_request:
    types: [opened, synchronize, reopened, edited]

permissions:
  pull-requests: read
  issues: write

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: Havertz2/contrib-gate@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
```

Every rule is configurable from the workflow file, and `fail-on-violations: true` turns it into a required status check if you want teeth. There's also a CLI mode (`node index.js --owner my-org --repo my-repo --pr 123`) for testing your rules locally before enforcing them.

The repo has a handful of `good first issue` tickets if you want to contribute - docs translations, a `--version` flag, step outputs, test coverage for the glob matcher. Feedback and issues are welcome.

Full disclosure, matching the tool's own rule: I built contrib-gate with heavy help from an AI assistant. The rules, the tests, and this post's opinions are mine; a lot of the typing was not.
