Skip to content
forked from rhysd/actionlint

About

Find problems in your GitHub Actions workflows

Topics

Resources

Contributing

Security policy

Stars

64 stars

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Latest commit

 

History

3,421 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

actionlint

CI Status Latest release NPM Version PyPI version pkg.pr.new Docker latest Sponsor this project

UPCOMING: actionlint v2. Try the master preview.

actionlint checks GitHub Actions workflows, action manifests and the scripts inside them.

Watch actionlint check workflows, scripts, and action metadata

Try the playground · Install · Browse the rules

One command checks workflows, actions, and scripts

actionlint check

actionlint discovers workflows and action manifests in a Git repository and follows local action and reusable-workflow dependencies.

What you wrote What actionlint checks
${{ matrix.platform }} Whether platform exists and has the expected type.
needs: [build] Whether the job exists and whether the dependencies form a cycle.
uses: ./actions/deploy Required inputs, declared outputs and composite steps.
A reusable-workflow call Inputs, secrets, outputs and permission constraints.
run: ... ShellCheck findings for shell and Ruff findings for Python.
${{ github.event.issue.title }} inside a script Whether untrusted text reaches executable script text.
runs-on, trigger filters, or a schedule Runner compatibility, glob syntax, cron expressions and time zones.

See the mistake before you push it

Save this workflow as .github/workflows/ci.yml and run actionlint check --output-format=pretty .github/workflows/ci.yml:

name: CI
on: push
permissions: {}
jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
      - run: echo "Testing"
error[expression-reference] unknown-property
  property "platform" is not defined in matrix
  --> .github/workflows/ci.yml:9:18
  |
9 |     runs-on: ${{ matrix.platform }}
  |                  ^^^^^^^^^^^^^^^
  = config: lint.rules.correctness.expression-reference

GitHub Actions features GitHub doesn't even know about

Build an action's inputs or env: entries with ${{ insert }}:

with:
  ${{ insert }}: >-
    ${{ fromJSON('{"fetch-depth": 0, "persist-credentials": false}') }}

actionlint checks the inserted names and values.

Use the weird parts of GitHub Actions

GitHub accepts comments inside JSON, unquoted keys, trailing text after the closing brace and mixed-case function names. actionlint understands them. The actions-rs CI workflow uses all of them:

runs-on: ${{ matrix.os }}
strategy:
  matrix: |-
    ${{
      FrOmJsOn(
        tOjSoN(
          fRoMjSoN(
            '{
              // load-bearing newline
              os:
              [
                ''ubuntu-latest'',
                "windows-latest"
                ,''macos-latest'',
              ],
              octal: [010], hex: ["0xFF"]
              /*,array_hole: [,]*/ , empty_string: [""]
              ,null_value: [null],undefined_value: ["undefined"],
              not_a_number: ["NaN"], positive_infinity: ["Infinity"]
              ,constructor: ["new Date()"],
            }
            this trailing sentence is apparently fine'
          )
        )
      )
    }}

actionlint resolves the matrix and reports the loose JSON as information. In the same workflow it catches if: ${{ format('{0}', false) }}. That expression yields the string "false", and the job runs.

The expression behavior guide explains why '017' == 17 and fromJSON('017') == 15 can both be true.

ShellCheck and Ruff belong in the same report

Initialize a project once:

actionlint config init --toml
actionlint check

config init installs the ShellCheck and Ruff WebAssembly plugins and pins their versions in .github/actionlint.toml. See script-linter configuration.

Preview the fix, then apply it

actionlint fix
actionlint fix --apply

The first command previews safe edits as JSON. The second applies them. Add --include-suggested to review edits that need a judgment call.

Get diagnostics and fixes while you edit

Run the language server over standard input and output:

actionlint lsp

The server checks unsaved buffers and offers quick fixes, suppressions and expression completion. See editor support. The browser playground runs the same server.

Check the actions your workflow calls

actionlint fetches remote action and reusable-workflow metadata to check inputs, outputs, secrets and permissions. Warm the cache before working offline:

actionlint cache warm .github/workflows
actionlint check --offline .github/workflows

See remote dependency checks.

Configure rules in TOML, with editor completion

Add rule settings to .github/actionlint.toml:

#:schema https://cdn.jsdelivr.net/gh/kjanat/actionlint@2/actionlint.schema.json

[lint.rules]
preset                            = "recommended"
security                          = "error"
suspicious.mixed-type-comparisons = "error"
conventions.job-timeout           = { level = "error", options = { max-minutes = 30 } }

[[overrides]]
includes                                   = [".github/workflows/legacy.yml"]
lint.rules.correctness.deprecated-commands = "off"

Tombi reads the schema directive for validation and completion.

actionlint rules
actionlint rules matrix
actionlint check --strict

YAML, JSON and JSONC also work. extends shares local or HTTPS configuration files.

Inspect the effective settings and their sources:

actionlint config show --origin
actionlint config validate
actionlint doctor

Migrate an existing configuration:

actionlint config migrate
actionlint config migrate --write

See configuration, the rule reference and the migration guide.

Add your own checks

WebAssembly plugins can analyze documents, check embedded languages or provide runner inventory.

actionlint plugin search shellcheck
actionlint plugin list
actionlint plugin sync
actionlint plugin update

sync restores the pinned versions. update resolves newer releases. The plugin guide has SDKs and examples.

Send results where you work

actionlint check --json
actionlint check --output-format=jsonl
actionlint check --output-format=github
actionlint check --output-format=sarif --output-file=actionlint.sarif

See result formats before you build a report consumer.

The GitHub Action adds annotations, job summaries, SARIF output and pull-request reviews. The integration guide covers pre-commit, Git hooks, reviewdog and editors.

Get actionlint

See the installation guide. Try the latest preview from master:

npx https://pkg.pr.new/kjanat/actionlint/@kjanat/actionlint@master

Or build from source with Go 1.27 or newer:

go install ./cmd/actionlint

Add Go's installation directory to PATH and keep git available. See usage and the v2 migration notes.

Build and contribute

Read the contributing guide, then use the project tools through mise:

mise exec -- runner install
mise exec -- go build ./cmd/actionlint
mise exec -- run test
mise exec -- run fmt

License

actionlint uses the MIT license. The identity artwork is by Kaj Kowalski and licensed under CC BY 4.0.

About

Find problems in your GitHub Actions workflows

Topics

Resources

Contributing

Security policy

Stars

64 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages