-
Notifications
You must be signed in to change notification settings - Fork 20
45 lines (41 loc) · 1.23 KB
/
sync-docs.yml
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
---
# yamllint disable rule:truthy rule:line-length
name: Sync Folders
on:
push:
branches:
- stable
paths:
- '.vale/**'
- 'docs/docs/**'
- 'docs/sidebars.ts'
pull_request:
branches:
- stable
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
path: source-repo
- name: Checkout target repository
uses: actions/checkout@v4
with:
repository: opsmill/infrahub-docs
token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }}
path: target-repo
- name: Sync folders
run: |
rm -rf target-repo/.vale/*
rm -rf target-repo/docs/docs/*
rm -f target-repo/docs/sidebars.ts
cp -r source-repo/.vale/* target-repo/.vale/
cp -r source-repo/docs/docs/* target-repo/docs/docs/
cp source-repo/docs/sidebars.ts target-repo/docs/sidebars.ts
cd target-repo
git config user.name github-actions
git config user.email [email protected]
git add .
if ! (git diff --quiet && git diff --staged --quiet); then git commit -m "Sync docs from infrahub repo" && git push; fi