Skip to content

raven-actions/actionlint

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

Repository files navigation

✅ actionlint Action

GitHub - marketplace GitHub - release GitHub - ci GitHub - license

This GitHub Action allows you to quickly and easily run actionlint in your GitHub workflow using native Runner OS without installing 3rd party dependencies. It is based on an official action lint usage proposal from Use actionlint on GitHub Actions together with Problem Matchers.

  • Action is platform-independent and tested on all the latest GitHub-hosted runners (ubuntu-latest, macos-latest, windows-latest).
  • Uses GitHub cache for caching actionlint binaries for faster and more efficient workflow run.
    • 3rd party actionlint dependencies like shellcheck or pyflakes are not cached, but action installs them if not present on the GitHub Runner using pipx (make sure your GitHub Runner has it).

demo-error

demo-ok

📑 Table of Contents

🛠️ Usage

Quick Start

Just place in your GitHub workflow steps:

- name: actionlint
  uses: raven-actions/actionlint@v2

Customization

You can modify the default configuration with optional inputs. All optional inputs are listed in the 📥 Inputs section.

Action returns some basic information. For more details, follow 📤 Outputs section.

- name: actionlint
  id: actionlint  #optional, id required only when outputs are used in the workflow steps later
  uses: raven-actions/actionlint@v2
  with:
    matcher: false  # optional
    cache: false  # optional
    fail-on-error: false  # optional
    files: "tests/*.yml, tests/*.yaml"  # optional, example on how to grab all .yml and .yaml files from the test directory
    flags: "-ignore SC2086"  # optional

- name: actionlint Summary
  if: ${{ steps.actionlint.outputs.exit-code != 0 }}  # example usage, do echo only when actionlint action failed
  run: |
    echo "Used actionlint version ${{ steps.actionlint.outputs.version-semver }}"
    echo "Used actionlint release ${{ steps.actionlint.outputs.version-tag }}"
    echo "actionlint ended with ${{ steps.actionlint.outputs.exit-code }} exit code"
    echo "actionlint ended because '${{ steps.actionlint.outputs.exit-message }}'"
    echo "actionlint found ${{ steps.actionlint.outputs.total-errors }} errors"
    echo "actionlint checked ${{ steps.actionlint.outputs.total-files }} files"
    echo "actionlint cache used: ${{ steps.actionlint.outputs.cache-hit }}"
    exit ${{ steps.actionlint.outputs.exit-code }}

📥 Inputs

Name Required Type Default value Description
version false string latest SemVer version of actionlint, recommended to keep default: latest
matcher false bool true Use matcher for GitHub annotations.
files false string not set To lint different workflow files (default searching directory is .github/workflows), use comma-separated glob patterns, e.g., tests/*.yml, tests/*.yaml
flags false string not set Extra flags to use with actionlint
group-result false bool true Use the GitHub log grouping feature for failure actionlint results.
fail-on-error false bool true Fail action on actionlint errors.
shellcheck false bool true Use shellcheck with actionlint (and install if it does not exist)
pyflakes false bool true Use pyflakes with actionlint (and install if it does not exist)
cache false bool true Use GitHub cache for caching binaries for the next runs.
github-token false string github.token GitHub Token for API authentication.

📤 Outputs

Name Type Description
version-semver string SemVer version of actionlint, recommended to keep default: latest
version-tag string Use matcher for GitHub annotations
exit-code int Exit status code based on actionlint exit status
exit-message string Exit status message based on actionlint exit status
total-errors int Total number of errors found during the linting
total-files int Total number of checked files
cache-hit bool GitHub cache has been used?

👥 Contributing

Contributions to the project are welcome! Please follow Contributing Guide.

🛡️ License

This project is distributed under the terms of the MIT license.