Skip to content
code

GitHub Action

Validate Config Files Action

v4.0.1 Latest version

Validate Config Files Action

code

Validate Config Files Action

Github Action to validate config files in a repo using the config-file-validator tool

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Validate Config Files Action

uses: kehoecj/[email protected]

Learn more about this action in kehoecj/validate-configs-action

Choose a version

Validate Configs Github Action

OpenSSF Scorecard Apache 2 License

:octocat: Github Action to validate your config files using the config-file-validator. The config-file-validator will recursively scan the provided search path for the following configuration file types:

  • Apple PList XML
  • CSV
  • EDITORCONFIG
  • ENV
  • HCL
  • HOCON
  • INI
  • JSON
  • Properties
  • TOML
  • XML
  • YAML

Each file will get validated for the correct syntax and the results collected into a report showing the path of the file and if it is invalid or valid. If the file is invalid an error will be displayed along with the line number and column where the error ocurred. By default the $GITHUB_WORKDIR is scanned.

Standard Run

Inputs

Input Required Default Value Description
search-paths false "." The path that will be recursively searched for configuration files
exclude-dirs false "" A comma-separated list of subdirectories to exclude from validation
exclude-file-types false "" A comma-separated list of file extensions to exclude. Possible values are xml, ini, yaml, yml, toml, and json
depth false "" An integer value limiting the depth of recursion for the search paths. For example, setting depth to 0 would disable recursion
reporter false "standard" Format of the report printed to stdout. Options are standard and json
group-by false "" Group output by filetype, directory, pass-fail

Outputs

N/A

Example usage

Standard Run

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]

Custom search path

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            search-path: ./project/configs

Multiple search paths

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            search-path: ./project/configs ./project/devops

Exclude a directory

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            exclude-dirs: "tests,vendor"

Exclude file type

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            exclude-file-types: "json,xml"

Disable recursive scanning

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            depth: 0

JSON Report

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            reporter: "json"

Group By Pass/Fail

jobs:
  validate-config-files:
    runs-on: ubuntu-latest
    steps:
      - uses: kehoe/[email protected]
        with:
            group-by: "pass-fail"