GitHub action to add Conftest to your GitHub Actions workflow.
Conftest is a utility to help you write tests against structured configuration data
Here we see a simple template that checks out the repository code, installs Conftest, and then runs a test against a yaml file.
name: Run Conftest Validation
on: [push]
jobs:
Run-OPA-Tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup Conftest
uses: princespaghetti/setup-conftest@v1
- name: Run Conftest
run: conftest test file.yaml
When Conftest is installed on the GitHub runner, you can select a the specific version of Conftest you wish to run.
steps:
- name: Setup Conftest
uses: princespaghetti/setup-conftest@v1
with:
version: 0.29.0
Or, Conftest can be locked to a SemVer range.
steps:
- name: Setup Conftest
uses: princespaghetti/setup-conftest@v1
with:
version: 0.31.x
steps:
- name: Setup Conftest
uses: princespaghetti/setup-conftest@v1
with:
version: 0.31
steps:
- name: Setup Conftest
uses: princespaghetti/setup-conftest@v1
with:
version: <0.31
The action supports the following inputs:
version
: Optional, defaults tolatest
and SemVer ranges are supported, so instead of a full version string, you can use0.29
or0.31
as the version.
This action does not set any direct outputs.
Thanks to the fine folks over at Infracost who created the initial version of setup-opa and the OPA team for their continued support of the action. This repository re-uses a large amount of the functionality with modifications for how Conftest is distributed.
The typescript action template also helpful to rapidly create this action.