-
Notifications
You must be signed in to change notification settings - Fork 10
32 lines (32 loc) · 1.09 KB
/
gatekeeper.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
on:
push:
branches:
- master
name: Gatekeeper
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Generate ConstraintTemplates for Gatekeeper
uses: garethr/policykit/action@master
with:
args: policy/SecurityControls.rego
- name: Commit to repository
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COMMIT_MSG: |
Generated new ConstraintTemplates from Rego source
skip-checks: true
run: |
# Hard-code user config
git config user.email "gareth@morethanseven.net"
git config user.name "Gareth Rushgrove"
git config --get-regexp "user\.(name|email)"
# Update origin with token
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
# Checkout the branch so we can push back to it
git checkout master
git add .
# Only commit and push if we have changes
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin master)