github-actionslint

How to lint GitHub Actions custom action files


When defining workflows for GitHub Actions, you can define custom actions, in order to share logic between workflows.

When working a lot on custom action files, having a linter that validate the syntax inside those files would be great, specifically a linter that could be run in a GitHub Actions workflow of its own when opening Pull Requests that changes these custom actions files.

Is there such a linter?

Pure YAML linters are not enough since GitHub Actions files have their own peculiarities (like ${{ ... }}, or the expression syntax in if:)

I have found actionlint, but despite its name, it only works on workflow files, and not on action files.

I am looking for a free to use action or library or executable that does the linting, not a GitHub App.


Solution

  • The 1.7.0 release of actionlint adds some support for linting action.yaml file. See the release notes for more information on how to lint action files.