masterpointio/OPA Rego Test and Coverage Report

Run OPA tests and generate coverage report for PRs. Test your OPA Rego policies!

View on GitHub

Trust Signals

Scorecard Score
not yet scored
Maintenance Recency
Stale
License
None
namedescriptionrequireddefault
pathPath to the directory containing OPA Rego files to test.yes
test_modeWhether to test the Rego by an entire directory (including entire package, e.g. `opa test ./`) or by individual files (e.g. `opa test a_test.rego a.rego`). Options of `directory` or `file`. Default is `directory`.nodirectory
test_file_postfixThe postfix to use for test files, only applicable for testing file by file. E.g. notification.rego <> notification_test.rego. Default is "_test".no_test
write_pr_commentFlag to write an user friendly PR comment of the test results. Default of true.notrue
pr_comment_titleTitle of the PR comment of the test results.no🧪 OPA Rego Policy Test Results
pr_comment_modeMode that will be used to update comment. Options of upsert (update in place) or recreate.upsert
run_coverage_reportFlag to run OPA coverage tests and write to the PR. The `write_pr_comment` must be enabled for the coverage report to be written. Default of true.notrue
report_untested_filesCheck & report in the PR comments of the Rego files that do not have any corresponding test files. For best conventions, append the postfix `_test` (or what you set as the `test_file_postfix` input) for your test file. E.g. `notification.rego` <> `notification_test.rego`nofalse
opa_versionVersion of OPA CLI to use. Default is 1.4.2, latest as of 2025-05-15.no1.4.2
opa_staticWhether to use the static binary. Default is false.nofalse
v1_compatible_checkFlag to run OPA v1 compatibility check (`opa check --v1-compatible`) on all Rego files in the path. Fails the action if any files are not Rego v1 compatible. Default of true.notrue
indicate_source_messageFlag to comment the origins (this repository) of the GitHub Action in the PR comment. Default of true.notrue
namedescription
parsed_resultsThe parsed results after processing the tests and/or coverage report.
tests_failedA `true` or `false` flag indicating if any of the tests failed or not.