|
| 1 | +name: Update CloudFormation Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: 0 5 * * MON |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + targetBranch: |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + default: 'main' |
| 12 | + |
| 13 | +jobs: |
| 14 | + update-cloudformation-coverage: |
| 15 | + name: Update CloudFormation coverage data |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout docs |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + path: docs |
| 23 | + ref: ${{ github.event.inputs.targetBranch || 'main' }} |
| 24 | + |
| 25 | + - name: Set up Python 3.11 |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: '3.11' |
| 29 | + |
| 30 | + - name: Skip odd weeks on schedule |
| 31 | + id: biweekly-gate |
| 32 | + env: |
| 33 | + EVENT_NAME: ${{ github.event_name }} |
| 34 | + run: | |
| 35 | + if [ "$EVENT_NAME" = "schedule" ] && [ $((10#$(date +%V) % 2)) -ne 0 ]; then |
| 36 | + echo "skip=true" >> "$GITHUB_OUTPUT" |
| 37 | + echo "Skipping this scheduled run to maintain biweekly cadence." |
| 38 | + else |
| 39 | + echo "skip=false" >> "$GITHUB_OUTPUT" |
| 40 | + fi |
| 41 | +
|
| 42 | + - name: Update CloudFormation coverage data |
| 43 | + if: steps.biweekly-gate.outputs.skip != 'true' |
| 44 | + working-directory: docs |
| 45 | + run: | |
| 46 | + python3 scripts/create_cloudformation_coverage.py |
| 47 | + env: |
| 48 | + NOTION_SECRET: ${{ secrets.NOTION_TOKEN }} |
| 49 | + |
| 50 | + - name: Check for changes |
| 51 | + if: steps.biweekly-gate.outputs.skip != 'true' |
| 52 | + id: check-for-changes |
| 53 | + working-directory: docs |
| 54 | + env: |
| 55 | + TARGET_BRANCH: ${{ github.event.inputs.targetBranch || 'main' }} |
| 56 | + run: | |
| 57 | + mkdir -p resources |
| 58 | + (git diff --name-only origin/automated-cloudformation-coverage-updates src/data/cloudformation/ 2>/dev/null || git diff --name-only "origin/$TARGET_BRANCH" src/data/cloudformation/ 2>/dev/null) | tee -a resources/diff-check.log |
| 59 | + echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> "$GITHUB_OUTPUT" |
| 60 | + cat resources/diff-check.log |
| 61 | +
|
| 62 | + - name: Create PR |
| 63 | + uses: peter-evans/create-pull-request@v7 |
| 64 | + if: ${{ success() && steps.biweekly-gate.outputs.skip != 'true' && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }} |
| 65 | + with: |
| 66 | + path: docs |
| 67 | + title: "Update CloudFormation coverage data" |
| 68 | + body: "Updating CloudFormation feature coverage data from the Notion resource database." |
| 69 | + branch: "automated-cloudformation-coverage-updates" |
| 70 | + author: "LocalStack Bot <localstack-bot@users.noreply.github.com>" |
| 71 | + committer: "LocalStack Bot <localstack-bot@users.noreply.github.com>" |
| 72 | + commit-message: "update generated cloudformation coverage data" |
| 73 | + token: ${{ secrets.PRO_ACCESS_TOKEN }} |
0 commit comments