GitHub Action Validator
ActionsTags
(2)An action that validates your actions.
This action uses Matt Palmer's action-validator tool that validates GitHub actions. Weirdly, there's not a GitHub action that validates actions, and the suggested usage is local in a pre-commit hook. But I like using actions for everything, so I created an action that validates actions when you're running actions. 😁
action-validator uses Rust and, therefore the output is very Rust-y. This is cool when you're actually using Rust, but in a GitHub actions context, it's not super friendly to get a bunch of Rust output in the GitHub workflow output. So, there's a Rust script that parses the Rust output wrapped in a bash script that which returns the results of the validation. (Yo dawg, I used Rust to Rust the Rust...)
name: Validate GitHub Actions Workflows
on:
pull_request:
paths:
- '.github/workflows/*.yml'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Validate GitHub Actions
uses: jazzsequence/github-action-validator@v1This action doesn't really need very many inputs. It will scan the default workflows directory by default so it works really without much need for config. If you do want to modify anything, there are a couple things you can tweak:
If you want to check any directory that does not match .github/workflows/*.yml, you can specify that path by adding this to your config.
Simple Example:
- name: Validate GitHub Actions
uses: jazzsequence/github-action-validator@v1
with:
path-to-workflows: '.github/actions/*.yaml'Advanced Example (Multiple Paths and Recursive Globbing):
- Recursive Globbing: You can use
**to match files nested in directories at any depth. - Multiple Paths: You can provide a multi-line string to validate several paths at the same time.
This example validates all workflows in the standard directory and also recursively finds all action.yml files inside the .github/actions directory. This is the only supported method for specifying multiple patterns, as it correctly handles filenames with spaces.
- name: Validate Workflows and Custom Actions
uses: jazzsequence/github-action-validator@v1
with:
path-to-workflows: |-
.github/workflows/*.yml
.github/actions/**/action.ymlBy default, the validator will output some super cool Xzibit ASCII art. Don't want that in your workflow? You can turn it off.
Example:
- name: Validate GitHub Actions
uses: jazzsequence/github-action-validator@v1
with:
show-ascii-art: falseGitHub Action Validator is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.
