-
-
Notifications
You must be signed in to change notification settings - Fork 24
46 lines (37 loc) · 1.35 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: build
on: ['pull_request']
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Execute OPA Tests
id: opa
run: |
result=$(docker run --rm --workdir /github/workspace \
-v $(pwd):/github/workspace \
openpolicyagent/opa:0.17.2 \
test policies/ -v || exit 0 )
result="${result//'%'/'%25'}"
result="${result//$'\n'/'%0A'}"
result="${result//$'\r'/'%0D'}"
echo "::set-output name=result::$result"
- uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### OPA Test Validation 🖌 \`${{ steps.opa.outcome }}\`
<details><summary>Show OPA Test Validation Report</summary>
\`\`\`
${{ steps.opa.outputs.result }}
\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`.\`, Workflow: \`${{ github.workflow }}\`*`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})