Skip to content

Commit 7ef370e

Browse files
authored
Automate replicator coverage (#1724)
1 parent 173f91e commit 7ef370e

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Update Replicator Coverage Docs
2+
on:
3+
schedule:
4+
- cron: 0 5 * * MON
5+
workflow_dispatch:
6+
inputs:
7+
targetBranch:
8+
required: false
9+
type: string
10+
default: 'main'
11+
jobs:
12+
update-replicator-docs:
13+
name: Update Replicator Coverage Docs
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout docs
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
path: docs
21+
ref: ${{ github.event.inputs.targetBranch || 'main' }}
22+
23+
- name: Set up system wide dependencies
24+
run: |
25+
sudo apt-get install jq
26+
27+
- name: Start LocalStack
28+
uses: LocalStack/[email protected]
29+
with:
30+
image-tag: 'latest'
31+
use-pro: true
32+
env:
33+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
34+
35+
- name: Create Replicator Coverage
36+
working-directory: docs
37+
run: |
38+
localstack auth set-token ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
39+
localstack replicator resources | jq --indent 4 . > data/replicator/coverage.json
40+
41+
- name: Check for changes
42+
id: check-for-changes
43+
working-directory: docs
44+
run: |
45+
# Check if there are changed files and store the result in resources/diff-check.log
46+
# Check against the PR branch if it exists, otherwise against the main
47+
# Store the result in resources/diff-check.log and store the diff count in the GitHub Action output "diff-count"
48+
mkdir -p resources
49+
(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
50+
echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT
51+
52+
- name: Create PR
53+
uses: peter-evans/create-pull-request@v7
54+
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
55+
with:
56+
path: docs
57+
title: "Update Replicator Coverage Docs"
58+
body: "Automatic updates of replicator supported resources"
59+
branch: "replicator-coverage-updates"
60+
author: "LocalStack Bot <[email protected]>"
61+
committer: "LocalStack Bot <[email protected]>"
62+
commit-message: "update generated replicator coverage file"
63+
token: ${{ secrets.PRO_ACCESS_TOKEN }}
64+
reviewers: cloutierMat,pinzon

0 commit comments

Comments
 (0)