A GitHub Action that runs Stylelint on changed files in a pull request and only annotates changed lines.
When triggered on a pull request, this action:
- Detects which files have changed compared to the base branch
- Filters for files matching the configured extensions (
.scss,.cssby default) - Runs Stylelint on only those files
- Compares lint results against the git diff to only annotate lines that were actually changed
This means existing lint violations won't clutter your PR — only new issues on lines you touched will be flagged.
Your repository must have Stylelint installed and configured (e.g., a .stylelintrc or stylelint.config.js).
# .github/workflows/stylelint.yml
name: Stylelint
on: [pull_request]
jobs:
balto-stylelint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
- run: npm ci
- uses: planningcenter/balto-stylelint@v1Note:
fetch-depth: 0is required so the action can diff against the base branch.
| Input | Description | Default |
|---|---|---|
failure-level |
The lowest annotation level to fail on ("warning" or "error") |
"error" |
conclusion-level |
Action conclusion ("success" or "failure") if failure-level annotations exist |
"success" |
working-directory |
Which directory to run the action in | "." |
extensions |
A comma separated list of extensions to run Stylelint on | ".scss,.css" |
| Output | Description |
|---|---|
warning-count |
Number of relevant warnings found |
error-count |
Number of relevant errors found |
total-count |
Number of relevant warnings and errors |
- Install devbox
- Run
devbox setup - Make your changes in
src/ - Run
npm run buildto bundle - Run
npm testto verify (requires act)
npm run dev # Watch mode — rebuilds and tests on file changes