Skip to content

IAM Definition Update #57

IAM Definition Update

IAM Definition Update #57

Workflow file for this run

name: IAM Definition Update
on:
schedule:
# Run on the first day of the month
- cron: '0 0 1 * *'
workflow_dispatch:
permissions:
contents: read
jobs:
update-actions:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.8'
- name: install dependencies
run: |
pip install -r requirements.txt
pip install click_log
- 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@5e914681df9dc83aa4e4905692ca88beb2f9e91f #v7.0.5
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.8'
- 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 integration.query
- run: invoke integration.write-policy
- run: invoke build.uninstall-package