forked from localstack/localstack-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (60 loc) · 2.59 KB
/
docs-replicator-updates.yml
File metadata and controls
67 lines (60 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Update Replicator Coverage Docs
on:
schedule:
- cron: 0 5 * * MON
workflow_dispatch:
inputs:
targetBranch:
required: false
type: string
default: 'main'
jobs:
update-replicator-docs:
name: Update Replicator Coverage 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 system wide dependencies
run: |
sudo apt-get install jq
- name: Start LocalStack
uses: LocalStack/setup-localstack@v0.2.3
with:
image-tag: 'latest'
use-pro: true
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
- name: Create Replicator Coverage
working-directory: docs
run: |
localstack auth set-token ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
localstack replicator resources | jq --indent 4 . > src/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-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
echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT
cat resources/diff-check.log
- 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 Coverage Docs"
body: "Automatic updates of replicator supported resources"
branch: "replicator-coverage-updates"
author: "LocalStack Bot <localstack-bot@users.noreply.github.com>"
committer: "LocalStack Bot <localstack-bot@users.noreply.github.com>"
commit-message: "update generated replicator coverage file"
token: ${{ secrets.PRO_ACCESS_TOKEN }}
reviewers: cloutierMat,pinzon