Guides
CI and pull requests
In CI, Plumber checks each pull request against the branch it merges into. Drift that's new in the changed files fails the check; drift you already had, recorded in the ledger, doesn't. Additions to the ledger need approval from someone you name.
Set it up
npx plumber install --ci
That writes .github/workflows/plumb.yml, if you don't have that file yet. When it detects no agent, it also writes AGENTS.md. In an npm project the workflow looks like this:
name: React Plumber
on:
pull_request:
pull_request_review:
types: [submitted, dismissed]
permissions:
contents: read
pull-requests: write
jobs:
plumb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '22.18.0'
- run: npm ci
- uses: unlocalhosted/plumb@v0.6.0
with:
base: ${{ github.event.pull_request.base.sha }}
working-directory: "."
ledger-approvers: ""
The installer uses the release tag of the version you have. Replace the tag with a commit SHA if you want it pinned. The install step matches your package manager and is there because Plumber compiles with your own Tailwind.
Inputs
| Input | Default | What it does |
|---|---|---|
base | the pull request's base commit | what to compare with |
working-directory | . | the folder with your Plumber config |
ledger-approvers | none | GitHub logins, separated by commas or spaces, who can approve ledger changes |
token | github.token | used to comment on the pull request |
What fails
The action runs plumber check --base <base>:
- New drift in a changed file fails. Drift in files the pull request didn't touch is still reported, but doesn't fail it.
- Debt and exceptions don't fail. When the pull request touches a line that has some, it's annotated so the reviewer sees it.
- A token that vanished or stale debt is a warning.
You can run the same check locally before you push:
npx plumber check --base main
Ledger changes need approval
Adding to the ledger lets drift in, so it needs a review. If a pull request adds an exception, accepts a changed decision or raises debt, one of your ledger-approvers must approve the pull request; if the author is an approver, that's enough. A later "changes requested" or a dismissed review cancels the approval.
Growing debt is an error even with approval, and approval doesn't clear any other error.
What the pull request shows
- Annotations on the changed lines: new drift as errors, touched debt and exceptions as notices.
- A summary comment on the pull request, updated on each run: how many findings are new, fixed, debt and exceptions, coverage per family against the base, ledger growth, and whether approval is needed.
## Plumber
1 new, 2 fixed, 7 debt, 0 exceptions.
## Coverage
spacing: 1/3 (33.3%); +33.3 pp vs base.
color: 2/2 (100%); +0 pp vs base.
## Ledger
0 growth lines.
The check passes when there are no new errors and any ledger additions are approved. On pull requests from forks, GitHub's default token is read-only, so the comment can't be posted.