Skip to content

Commit 7d8baf0

Browse files
authored
add replicator coverage automation (#30)
* add replicator coverage automation * fix * testing * another fix * last fix * last fix
1 parent 82ae826 commit 7d8baf0

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Update Replicator Coverage Docs
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: 'master'
12+
13+
jobs:
14+
update-replicator-docs:
15+
name: Update Replicator Coverage Docs
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 || 'master' }}
24+
25+
- name: Set up system wide dependencies
26+
run: |
27+
sudo apt-get install jq
28+
29+
- name: Start LocalStack
30+
uses: LocalStack/setup-localstack@v0.2.3
31+
with:
32+
image-tag: 'latest'
33+
use-pro: true
34+
env:
35+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
36+
37+
- name: Create Replicator Coverage
38+
working-directory: docs
39+
run: |
40+
localstack auth set-token ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
41+
localstack replicator resources | jq --indent 4 . > src/data/replicator/coverage.json
42+
43+
- name: Check for changes
44+
id: check-for-changes
45+
working-directory: docs
46+
run: |
47+
# Check if there are changed files and store the result in resources/diff-check.log
48+
# Check against the PR branch if it exists, otherwise against the master
49+
# Store the result in resources/diff-check.log and store the diff count in the GitHub Action output "diff-count"
50+
mkdir -p resources
51+
(git diff --name-only origin/replicator-coverage-updates src/data/replicator/coverage.json 2>/dev/null || git diff --name-only origin/${{ github.event.inputs.targetBranch || 'master' }} src/data/replicator/coverage.json 2>/dev/null) | tee resources/diff-check.log
52+
echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT
53+
54+
- name: Create PR
55+
uses: peter-evans/create-pull-request@v7
56+
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
57+
with:
58+
path: docs
59+
title: "Update Replicator Coverage Docs"
60+
body: "Automatic updates of replicator supported resources"
61+
branch: "replicator-coverage-updates"
62+
author: "LocalStack Bot <localstack-bot@users.noreply.github.com>"
63+
committer: "LocalStack Bot <localstack-bot@users.noreply.github.com>"
64+
commit-message: "update generated replicator coverage file"
65+
token: ${{ secrets.PRO_ACCESS_TOKEN }}
66+
reviewers: cloutierMat,pinzon

0 commit comments

Comments
 (0)