SCALRCORE-31241: Policy example for workspace.environment_type #238
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OPA | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Setup OPA | |
uses: open-policy-agent/setup-opa@v2 | |
with: | |
version: latest | |
- name: Run OPA Tests | |
run: | | |
dirs=$(find . -type f -name '*.rego' -exec dirname {} \; | sort -u) | |
echo "Directories to be tested:" | |
for dir in $dirs; do | |
echo "$dir" | |
done | |
for dir in $dirs; do | |
echo "Running tests in $dir" | |
if ! opa test $dir/ -v --format pretty; then | |
echo "Tests failed in $dir" | |
exit 1 | |
fi | |
done |