Skip to content

Commit fa0390e

Browse files
committed
add replicator coverage automation
1 parent 82ae826 commit fa0390e

File tree

2 files changed

+67
-18
lines changed

2 files changed

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

src/data/replicator/coverage.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
[
2-
{
3-
"resource_type": "AWS::EC2::SecurityGroup",
4-
"policy_statements": [
5-
"cloudformation:GetResource",
6-
"ec2:DescribeSecurityGroups"
7-
],
8-
"service": "ec2",
9-
"identifier": "GroupId"
10-
},
112
{
123
"resource_type": "AWS::EC2::Subnet",
134
"policy_statements": [
@@ -85,14 +76,5 @@
8576
],
8677
"service": "ssm",
8778
"identifier": "Name"
88-
},
89-
{
90-
"resource_type": "AWS::SecretsManager::Secret",
91-
"policy_statements": [
92-
"cloudformation:GetResource",
93-
"secretsmanager:DescribeSecret"
94-
],
95-
"service": "secretsmanager",
96-
"identifier": "Arn"
9779
}
9880
]

0 commit comments

Comments
 (0)