A GitHub Action that catches broken config files in your PRs before they cause problems. Supports JSON, YAML, TOML, XML, INI, HCL, JSONC, KDL, Justfiles, and a bunch more. Errors show up as inline annotations on the PR diff so you know exactly what broke and where.
If a file has a $schema or XSD declaration, it gets schema-validated too. You can also enable SchemaStore for automatic schema lookups on common files like package.json and tsconfig.json.
- uses: Boeing/validate-configs-action@v2Add it to any job with actions/checkout and it'll validate every config file in the repo.
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Boeing/validate-configs-action@v2If you've got a big repo, you probably don't want to validate everything on every PR:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Boeing/validate-configs-action@v2
with:
only-changed: "true"You need fetch-depth: 0 so git can figure out which files actually changed.
Skip the stuff you don't care about:
- uses: Boeing/validate-configs-action@v2
with:
exclude-dirs: "vendor,testdata,node_modules"Already have a .dockerignore or .prettierignore? Use those same patterns to skip files:
- uses: Boeing/validate-configs-action@v2
with:
ignore-files: ".dockerignore,.prettierignore"SchemaStore is a community catalog of JSON Schemas for common config files. Turn it on and you get schema validation for hundreds of files out of the box:
- uses: Boeing/validate-configs-action@v2
with:
schemastore: "true"- uses: Boeing/validate-configs-action@v2
id: validate
continue-on-error: true
- run: |
echo "Files validated: ${{ steps.validate.outputs.files-validated }}"
echo "Files failed: ${{ steps.validate.outputs.files-failed }}"| Input | Default | Description |
|---|---|---|
search-paths |
"." |
Space-separated dirs or files to scan |
exclude-dirs |
"" |
Comma-separated dirs to skip |
exclude-file-types |
"" |
Comma-separated file types to skip (e.g. csv,xml) |
file-types |
"" |
Only validate these file types. Can't use with exclude-file-types |
depth |
"" |
Recursion depth. 0 means don't recurse |
reporter |
"standard" |
Output format. Options: standard, json, junit, sarif, github. Use type:path for file output, comma-separate for multiple |
group-by |
"" |
Group output: filetype, directory, or pass-fail |
quiet |
"false" |
Suppress stdout |
globbing |
"false" |
Use glob patterns in search-paths. Can't combine with exclude-dirs/exclude-file-types/file-types |
require-schema |
"false" |
Fail files that could have a schema but don't declare one |
no-schema |
"false" |
Skip all schema validation, syntax only |
schemastore |
"false" |
Auto-lookup schemas from the embedded SchemaStore catalog |
schemastore-path |
"" |
Path to a local SchemaStore clone (for air-gapped envs). Implies schemastore |
type-map |
"" |
Map globs to file types: pattern:type (e.g. **/inventory:ini) |
schema-map |
"" |
Map globs to schemas: pattern:schema_path (e.g. **/config.json:schemas/config.schema.json) |
only-changed |
"false" |
Only check files changed in the current PR |
gitignore |
"false" |
Skip files matched by .gitignore |
ignore-files |
"" |
Comma-separated list of gitignore-style pattern files to use as filters (e.g. .dockerignore,.prettierignore) |
csv, editorconfig, env, hcl (.tf, .tfvars), hocon, ini, json, jsonc, justfile, kdl, plist, properties, sarif, toml, toon, xml, yaml
Plus ~90 well-known filenames (.babelrc, tsconfig.json, Pipfile, pom.xml, etc.) are auto-detected even without a file extension.
| Output | Description |
|---|---|
files-validated |
Total files scanned |
files-failed |
Files that failed validation |
exit-code |
0 = success, 1 = validation errors, 2 = runtime error |
Filtering
- uses: Boeing/validate-configs-action@v2
with:
file-types: "json,yaml"- uses: Boeing/validate-configs-action@v2
with:
exclude-file-types: "csv,xml"- uses: Boeing/validate-configs-action@v2
with:
depth: 0- uses: Boeing/validate-configs-action@v2
with:
globbing: "true"
search-paths: "**/*.json config/**/*.yaml"- uses: Boeing/validate-configs-action@v2
with:
ignore-files: ".dockerignore,.prettierignore"Reporters
- uses: Boeing/validate-configs-action@v2
with:
reporter: "github"- uses: Boeing/validate-configs-action@v2
with:
reporter: "json"- uses: Boeing/validate-configs-action@v2
with:
reporter: "standard,json:output.json,junit:results.xml,sarif:results.sarif"- uses: Boeing/validate-configs-action@v2
with:
group-by: "pass-fail"Schema Validation
- uses: Boeing/validate-configs-action@v2
with:
schemastore: "true"- run: git clone --depth=1 https://github.com/SchemaStore/schemastore.git
- uses: Boeing/validate-configs-action@v2
with:
schemastore-path: "./schemastore"- uses: Boeing/validate-configs-action@v2
with:
require-schema: "true"- uses: Boeing/validate-configs-action@v2
with:
no-schema: "true"- uses: Boeing/validate-configs-action@v2
with:
schema-map: "**/package.json:schemas/package.schema.json,**/config.xml:schemas/config.xsd"Advanced
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Boeing/validate-configs-action@v2
with:
only-changed: "true"
exclude-dirs: "vendor,generated,testdata"
ignore-files: ".prettierignore"
schema-map: "**/app-config.json:schemas/app.schema.json"
type-map: "**/inventory:ini,**/.env.*:env"
reporter: "standard,junit:results.xml"
schemastore: "true"- uses: Boeing/validate-configs-action@v2
with:
type-map: "**/inventory:ini,**/*.cfg:json"- uses: Boeing/validate-configs-action@v2
id: validate
continue-on-error: true
- run: |
if [ "${{ steps.validate.outputs.files-failed }}" != "0" ]; then
echo "😬 ${{ steps.validate.outputs.files-failed }} files failed"
exit 1
fi