-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (43 loc) · 1.43 KB
/
ci-apps-gator.yaml
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
name: ci-apps-gator
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
- 'docs/**'
- '.github/workflows/ci-apps-kpt.yaml'
- '.github/workflows/ci-policies.yaml'
pull_request:
paths-ignore:
- '**/README.md'
- 'docs/**'
- '.github/workflows/ci-apps-kpt.yaml'
- '.github/workflows/ci-policies.yaml'
jobs:
gator:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: install gator
run: |
curl -OL https://github.com/open-policy-agent/gatekeeper/releases/download/v${GATOR_VERSION}/gator-v${GATOR_VERSION}-linux-amd64.tar.gz
tar xvf gator-v${GATOR_VERSION}-linux-amd64.tar.gz && rm gator-v${GATOR_VERSION}-linux-amd64.tar.gz
env:
GATOR_VERSION: 3.12.0
- name: gator test
id: gator
run: |
rm -rf test
rm -rf .github
./gator test -f . -o json > gator-error.json
- name: write errors in summary
if: ${{ failure() && steps.gator.outcome == 'failure' }}
run: |
if [ -f gator-error.json ]; then
echo "❌ gator errors:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat gator-error.json | jq -r '.[]? | "➡️ \(.constraint.metadata.name) - \(.msg)"' | sed 's/<//g;s/>//g' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
rm gator-error.json
fi