Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/_policy_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ name: Policy Test
on:
workflow_call:


jobs:
test:
runs-on: ubuntu-latest
# permissions:
# id-token: write
# contents: read
# pull-requests: write # required to comment on PRs
steps:
- name: Checkout source
uses: actions/checkout@v4.2.2

- name: Setup OPA
uses: open-policy-agent/setup-opa@v2.2.0
- name: Run OPA Rego Tests
uses: masterpointio/github-action-opa-rego-test@main
with:
version: latest

- name: Test
run: opa test ./policy -v
path: ./policy
test_mode: directory # Whether to test the Rego by directory (e.g. opa test ./) or by individual files (e.g. opa test a_test.rego a.rego). Options of `directory` or `file`.
report_untested_files: true # Flag to check & report Rego files that does NOT have corresponding test files. Optional, defaults to false.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
uses: ./.github/workflows/_policy_lint.yaml

policy_test:
permissions:
id-token: write
contents: read
pull-requests: write # required to comment on PRs
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
uses: ./.github/workflows/_policy_test.yaml
Expand Down
Loading