Skip to content
Ashlarv1.2.1

Run the check in GitHub Actions

Fail a pull request when it makes a file worse than the baseline holds.

Give the check a script in package.json.

package.json
{
"scripts": {
"check": "ashlar check"
}
}

Run that script on every pull request. Ashlar compares with origin/main to tell which lines a change wrote, so the checkout fetches the whole history.

.github/workflows/check.yml
name: Check
on:
pull_request:
push:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm check

A pull request that adds a comment to src/run/run.ts now fails its check.

Terminal
$ pnpm check
Ashlar checked 3 files in 0.1 s: 1 count rose.
no-comment in src/run/run.ts: 1, up from 0
src/run/run.ts:3:1
Comments go stale and nothing checks them. Rename it, or write a test. Git leads from any line to the item or task that wrote it.

Take the baseline first, as Adopt Ashlar in an existing repository shows.