-
Notifications
You must be signed in to change notification settings - Fork 133
70 lines (65 loc) · 2.51 KB
/
update.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: IAM Definition Update
on:
schedule:
# Run on the first day of the month
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
update-actions:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Setup python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.7'
- name: install dependencies
run: pip install requests schema PyYAML click click_log beautifulsoup4
- name: install policy_sentry
run: echo "PYTHONPATH=$(pwd)" >> "$GITHUB_ENV"
- name: Run initialize
run: |
python .github/scripts/update_data.py
if [[ $(du -m /tmp/.policy_sentry/iam-definition.json | cut -f1) -lt 3 ]]; then
echo "File size is less than 3 MB, something is wrong with this update"
exit 1
fi
cp -f /tmp/.policy_sentry/iam-definition.json "$(pwd)/policy_sentry/shared/data/iam-definition.json"
cp -rf /tmp/.policy_sentry/data/docs "$(pwd)/policy_sentry/shared/data/"
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: PR if files were updated
uses: peter-evans/create-pull-request@c55203cfde3e5c11a452d352b4393e68b85b4533 #v6.0.3
with:
commit-message: Update database
title: 'Updates database'
body: This is an automated PR created because AWS IAM definitions have changed.
branch: ${{ steps.vars.outputs.sha_short }}
delete-branch: true
labels: |
automation
ci-after-update:
runs-on: ubuntu-latest
needs: update-actions
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.7'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- run: invoke build.install-package
- run: invoke integration.clean
- run: invoke integration.version
- run: invoke integration.initialize
- run: invoke unit.pytest
# - run: invoke test.lint
- run: invoke test.security
- run: invoke integration.query
- run: invoke integration.write-policy
- run: invoke build.uninstall-package