{"id":17678265,"url":"https://github.com/babarot/action-conftest","last_synced_at":"2025-03-12T12:30:39.893Z","repository":{"id":43268197,"uuid":"240079866","full_name":"babarot/action-conftest","owner":"babarot","description":"Run conftest test command with GitHub Actions","archived":true,"fork":false,"pushed_at":"2023-11-19T11:24:36.000Z","size":412,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T08:02:05.546Z","etag":null,"topics":["conftest","github-actions","opa","openpolicyagent","rego"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/babarot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-12T18:02:14.000Z","updated_at":"2025-01-15T14:50:36.000Z","dependencies_parsed_at":"2024-10-24T09:43:24.008Z","dependency_job_id":"3ccbbda4-9a75-4efa-ab58-02df9534f6f3","html_url":"https://github.com/babarot/action-conftest","commit_stats":null,"previous_names":["babarot/action-conftest","b4b4r07/action-conftest"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babarot%2Faction-conftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babarot%2Faction-conftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babarot%2Faction-conftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babarot%2Faction-conftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/babarot","download_url":"https://codeload.github.com/babarot/action-conftest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243217964,"owners_count":20255632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conftest","github-actions","opa","openpolicyagent","rego"],"created_at":"2024-10-24T08:04:23.393Z","updated_at":"2025-03-12T12:30:39.534Z","avatar_url":"https://github.com/babarot.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"action-conftest\n===============\n\n[![](https://github.com/b4b4r07/action-conftest/workflows/release/badge.svg)](https://github.com/b4b4r07/action-conftest/releases)\n\n![](docs/demo.png)\n\nRun [conftest test](https://github.com/instrumenta/conftest) command with GitHub Actions\n\nYou can use the fixed version from: [Releases](https://github.com/b4b4r07/action-conftest/releases/latest)\n\n## Usage\n\nA whole example is here:\n\n```yaml\nname: conftest\n\non: [pull_request]\n\njobs:\n  conftest:\n    name: conftest test\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v1\n    - name: Get changed objects\n      uses: b4b4r07/action-changed-objects@master\n      with:\n        added: 'true'\n        deleted: 'false'\n        modified: 'true'\n      id: objects\n    - name: Run conftest test against changed files\n      uses: b4b4r07/action-conftest@master\n      if: steps.objects.outputs.changed\n      with:\n        files: ${{ steps.objects.outputs.changed }}\n        matches: '*.yaml'\n      id: conftest\n    - name: Post conftest command result to GitHub comment\n      uses: b4b4r07/action-github-comment@master\n      if: always() \u0026\u0026 steps.conftest.outputs.result\n      with:\n        body: |\n          ## conftest test result\n          ```\n          ${{ steps.conftest.outputs.result }}\n          ```\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        LOG: trace\n```\n\nIf you want to run [conftest](https://github.com/instrumenta/conftest) command against only changed config files, you need to use [b4b4r07/action-changed-objects](https://github.com/b4b4r07/action-changed-objects) to get the changed files in Git commit. It defaults to compare with checkout-ed branch and origin/master branch.\n\nIn addition, you can filter the changed files, for example, let's say you want to test only changed JSON and YAML files:\n\n```yaml\n      with:\n        files: ${{ steps.objects.outputs.changed }}\n        matches: '*.json manifests/*.yaml'\n```\n\nBesides, if you want to post the `conftest test` command result on your pull requests, you need to set the step `Post conftest command result to GitHub comment`. The contents of `body` is the message itself. You can configure it as Markdown. For more details, please see also [b4b4r07/action-github-comment](https://github.com/b4b4r07/action-github-comment).\n\nTo put the comment on GitHub even if the previous `conftest` step is failed, you need to set [`always()` condition](https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions#job-status-check-functions) like this:\n\n```yaml\n      if: always() \u0026\u0026 steps.conftest.outputs.result\n```\n\nThis means the comment will be posted to GitHub regardless of previous build step but at least the output of previous step needs to be not empty.\n\n\u003cimg src=\"docs/comment.png\" width=\"600\"\u003e\n\n## Customizing\n\n### inputs\n\nThe following are optional as `step.with` keys\n\n| Name       | Type   | Description                                                               | Default |\n| ---------- | ------ | ------------------------------------------------------------------------- | ------- |\n| `path`     | String | Path to directory where config files are located                          | `.`     |\n| `policy`   | String | Path to the Rego policy files directory                                   | `policy`|\n| `files`    | String | A list of config file to be tested by conftest. Separated by a space      |         |\n| `matches`  | String | A list of cases to be tested (e.g. \"*.yaml *.json\"). Separated by a space |         |\n| `namespace`| String | Namespace name running with conftest testing                              |         |\n| `all_namespaces`| Boolean | Enable --all-namespaces flag                                        | `false` |\n\nWhen providing a `path` and `files` at the same time, `files` will be attempted first, then falling back on `path` if the files can not be got from.\n\n### outputs\n\nThe following outputs can be accessed via `${{ steps.\u003cstep-id\u003e.outputs }}` from this action\n\n| Name     | Type   | Description                   |\n| -------- | ------ | ----------------------------- |\n| `result` | String | Outputs of `conftest` command |\n\n### environment variables\n\nThe following are as `step.env` keys\n\n| Name | Description |\n| ---- | ----------- |\n| n/a  | n/a         |\n\n## License\n\n[MIT](https://b4b4r07.mit-license.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabarot%2Faction-conftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbabarot%2Faction-conftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabarot%2Faction-conftest/lists"}