This GitHub Action runs the actionlint-oneline pre-commit hook on a diff range
and reports results to pull requests using reviewdog.
Typical use case:
- Run
actionlint-onelineon changed workflow files - Annotate problems directly on the PR diff
- Fail the job if violations are found
Add the actionlint hooks to your .pre-commit-config.yaml, including the actionlint-oneline alias with the manual stage:
repos:
- repo: https://github.com/rhysd/actionlint
rev: v1.7.8
hooks:
- id: actionlint
name: actionlint
files: ^\.github/workflows/.*\.(yml|yaml)$
args: ["-shellcheck"]
- id: actionlint
alias: actionlint-oneline
name: actionlint (one line per one error)
files: ^\.github/workflows/.*\.(yml|yaml)$
args: ["-oneline", "-shellcheck"]
stages: [manual]You also need:
- GitHub Actions enabled on the repository
secrets.GITHUB_TOKENavailable (default on GitHub-hosted runners)actions/checkoutfetching enough history to include bothfrom-refandto-ref, for example:
- uses: actions/checkout@v4
with:
fetch-depth: 0| 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 actionlint-oneline hook |
Example workflow for pull requests:
name: Lint workflows with actionlint
on:
pull_request:
jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run actionlint via pre-commit + reviewdog
uses: leinardi/gha-pre-commit-actionlint-reviewdog@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: leinardi/gha-pre-commit-actionlint-reviewdog@v1For fully reproducible behavior, pin to an exact tag:
uses: leinardi/[email protected]