Template README — replace
<TOOL>and<HOOK_ID>with your actual tool and pre-commit hook name.
This GitHub Action runs a single pre-commit hook on a diff range and reports results to pull requests
using reviewdog.
Typical use case:
- Run the
<HOOK_ID>pre-commit hook (e.g.actionlint-oneline) - Annotate problems directly on the PR diff
- Fail the job if violations are found
- A
.pre-commit-config.yamlin your repository with the<HOOK_ID>hook enabled - GitHub Actions enabled on the repository
secrets.GITHUB_TOKENavailable (default on GitHub-hosted runners)
| Name | Required | Description |
|---|---|---|
from-ref |
✅ | Base git ref (e.g. PR base SHA) |
to-ref |
✅ | Head git ref (e.g. PR head SHA) |
github-token |
✅ | GitHub token for reviewdog (secrets.GITHUB_TOKEN) |
| Name | Description |
|---|---|
exitcode |
Exit code of the <HOOK_ID> pre-commit hook |
In your workflow (example for a pull request):
name: Lint with <TOOL>
on:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run <TOOL> via pre-commit + reviewdog
uses: <OWNER>/<REPO>@v1
with:
from-ref: ${{ github.event.pull_request.base.sha }}
to-ref: ${{ github.event.pull_request.head.sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}It’s recommended to pin to the major version:
uses: <OWNER>/<REPO>@v1For fully reproducible behavior, pin to an exact tag:
uses: <OWNER>/<REPO>@v1.0.0