From 855157eaedad6a00b857bf9e3f45e46bd80c2d0b Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 11:42:47 -0600 Subject: [PATCH 1/8] create workflow --- .github/workflows/docs-replicator-updates.yml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/docs-replicator-updates.yml diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml new file mode 100644 index 0000000000..ada43b3e3e --- /dev/null +++ b/.github/workflows/docs-replicator-updates.yml @@ -0,0 +1,63 @@ +name: Update Parity Docs +on: + schedule: + - cron: 0 5 * * MON + workflow_dispatch: + inputs: + targetBranch: + required: false + type: string + default: 'main' +jobs: + update-replicator-docs: + name: Update Replicator Docs + runs-on: ubuntu-latest + steps: + - name: Checkout docs + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: docs + ref: ${{ github.event.inputs.targetBranch || 'main' }} + + - name: Set up Python 3.11 + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Start LocalStack + uses: LocalStack/setup-localstack@v0.2.3 + with: + image-tag: 'latest' + env: + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + + - name: Create Replicator Docs + working-directory: docs + run: localstack replicator resource | jq --indent 4 . > data/replicator/coverage.json + + - name: Check for changes + id: check-for-changes + working-directory: docs + run: | + # Check if there are changed files and store the result in resources/diff-check.log + # Check against the PR branch if it exists, otherwise against the main + # Store the result in resources/diff-check.log and store the diff count in the GitHub Action output "diff-count" + mkdir -p resources + (git diff --name-only origin/replicator-auto-updates data/replicator/coverage.json 2>/dev/null || git diff --name-only origin/${{ github.event.inputs.targetBranch || 'main' }} data/replicator/coverage.json 2>/dev/null) | tee resources/diff-check.log + echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT + + - name: Create PR + uses: peter-evans/create-pull-request@v7 + if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }} + with: + path: docs + title: "Update Replicator Docs" + body: "Automatic updates of replicator supported resources" + branch: "replicator-auto-updates" + author: "LocalStack Bot " + committer: "LocalStack Bot " + commit-message: "update generated replicator docs" + token: ${{ secrets.PRO_ACCESS_TOKEN }} + reviewers: cloutierMat,pinzon From ad7b83b295421f800c5eba6e97c62605252e6be2 Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 11:45:27 -0600 Subject: [PATCH 2/8] update pr --- .github/workflows/docs-replicator-updates.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index ada43b3e3e..15346351c8 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -2,6 +2,9 @@ name: Update Parity Docs on: schedule: - cron: 0 5 * * MON + push: + branches: + - automate-replicator-coverage workflow_dispatch: inputs: targetBranch: From 55079e8c1d716e8b8453221faf1d772b1b8e225f Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 11:52:10 -0600 Subject: [PATCH 3/8] update dependencies and env --- .github/workflows/docs-replicator-updates.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index 15346351c8..0bb0fb4300 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -23,11 +23,9 @@ jobs: path: docs ref: ${{ github.event.inputs.targetBranch || 'main' }} - - name: Set up Python 3.11 - id: setup-python - uses: actions/setup-python@v5 - with: - python-version: "3.11" + - name: Set up system wide dependencies + run: | + sudo apt-get install jq - name: Start LocalStack uses: LocalStack/setup-localstack@v0.2.3 @@ -38,6 +36,8 @@ jobs: - name: Create Replicator Docs working-directory: docs + env: + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} run: localstack replicator resource | jq --indent 4 . > data/replicator/coverage.json - name: Check for changes @@ -63,4 +63,4 @@ jobs: committer: "LocalStack Bot " commit-message: "update generated replicator docs" token: ${{ secrets.PRO_ACCESS_TOKEN }} - reviewers: cloutierMat,pinzon + reviewers: cloutierMat From b980611d31f2272318dd3e7facba2b6ee6558645 Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 11:57:08 -0600 Subject: [PATCH 4/8] use pro --- .github/workflows/docs-replicator-updates.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index 0bb0fb4300..20818763a4 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -31,6 +31,7 @@ jobs: uses: LocalStack/setup-localstack@v0.2.3 with: image-tag: 'latest' + use-pro: true env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} From 031f920da8e558494a310ee516cf300d1b9c443e Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 12:05:52 -0600 Subject: [PATCH 5/8] debug --- .github/workflows/docs-replicator-updates.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index 20818763a4..2712254eb0 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -13,7 +13,7 @@ on: default: 'main' jobs: update-replicator-docs: - name: Update Replicator Docs + name: Update Replicator Coverage Docs runs-on: ubuntu-latest steps: - name: Checkout docs @@ -34,8 +34,9 @@ jobs: use-pro: true env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + LOCALSTACK_DEBUG: 1 - - name: Create Replicator Docs + - name: Create Replicator Coverage working-directory: docs env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} @@ -49,7 +50,7 @@ jobs: # Check against the PR branch if it exists, otherwise against the main # Store the result in resources/diff-check.log and store the diff count in the GitHub Action output "diff-count" mkdir -p resources - (git diff --name-only origin/replicator-auto-updates data/replicator/coverage.json 2>/dev/null || git diff --name-only origin/${{ github.event.inputs.targetBranch || 'main' }} data/replicator/coverage.json 2>/dev/null) | tee resources/diff-check.log + (git diff --name-only origin/replicator-coverage-updates data/replicator/coverage.json 2>/dev/null || git diff --name-only origin/${{ github.event.inputs.targetBranch || 'main' }} data/replicator/coverage.json 2>/dev/null) | tee resources/diff-check.log echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT - name: Create PR @@ -59,9 +60,9 @@ jobs: path: docs title: "Update Replicator Docs" body: "Automatic updates of replicator supported resources" - branch: "replicator-auto-updates" + branch: "replicator-coverage-updates" author: "LocalStack Bot " committer: "LocalStack Bot " - commit-message: "update generated replicator docs" + commit-message: "update generated replicator coverage file" token: ${{ secrets.PRO_ACCESS_TOKEN }} reviewers: cloutierMat From e78058f1760a5865f74dfa30f4ae98406772fa1e Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 12:14:32 -0600 Subject: [PATCH 6/8] more debug --- .github/workflows/docs-replicator-updates.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index 2712254eb0..c978ba7f25 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -39,6 +39,7 @@ jobs: - name: Create Replicator Coverage working-directory: docs env: + LOCALSTACK_DEBUG: 1 LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} run: localstack replicator resource | jq --indent 4 . > data/replicator/coverage.json From a98ca45714df538608142880cd9c47e74f8665db Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 12:18:40 -0600 Subject: [PATCH 7/8] fix steps and add set auth to explicitly fail if auth is not found --- .github/workflows/docs-replicator-updates.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index c978ba7f25..27627bc925 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -34,14 +34,12 @@ jobs: use-pro: true env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} - LOCALSTACK_DEBUG: 1 - name: Create Replicator Coverage working-directory: docs - env: - LOCALSTACK_DEBUG: 1 - LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} - run: localstack replicator resource | jq --indent 4 . > data/replicator/coverage.json + run: | + localstack auth set-token ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + localstack replicator resources | jq --indent 4 . > data/replicator/coverage.json - name: Check for changes id: check-for-changes From b6615f3a7c2439b60776e1288289ff5adc353c7b Mon Sep 17 00:00:00 2001 From: Mathieu Cloutier Date: Wed, 2 Apr 2025 12:24:43 -0600 Subject: [PATCH 8/8] remove push trigger --- .github/workflows/docs-replicator-updates.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs-replicator-updates.yml b/.github/workflows/docs-replicator-updates.yml index 27627bc925..3e3c1a2473 100644 --- a/.github/workflows/docs-replicator-updates.yml +++ b/.github/workflows/docs-replicator-updates.yml @@ -1,10 +1,7 @@ -name: Update Parity Docs +name: Update Replicator Coverage Docs on: schedule: - cron: 0 5 * * MON - push: - branches: - - automate-replicator-coverage workflow_dispatch: inputs: targetBranch: @@ -57,11 +54,11 @@ jobs: if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }} with: path: docs - title: "Update Replicator Docs" + title: "Update Replicator Coverage Docs" body: "Automatic updates of replicator supported resources" branch: "replicator-coverage-updates" author: "LocalStack Bot " committer: "LocalStack Bot " commit-message: "update generated replicator coverage file" token: ${{ secrets.PRO_ACCESS_TOKEN }} - reviewers: cloutierMat + reviewers: cloutierMat,pinzon