-
Notifications
You must be signed in to change notification settings - Fork 79
52 lines (45 loc) · 1.71 KB
/
wiki-sync.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
46
47
48
49
50
51
52
---
name: Docs/Wiki Sync
on:
release:
types: [published]
workflow_dispatch:
env:
wiki_source_repo: "${{ github.repository }}"
wiki_source_repo_dir: "${{ github.repository }}/docs/wiki"
wiki_target_repo: "${{ github.repository }}.wiki"
github_user_name: "github-actions"
github_email: "[email protected]"
github_commit_message: "GitHub Action syncing wiki from docs/wiki"
jobs:
sync-wiki:
name: Sync Wiki
if: github.repository == 'Azure/terraform-azurerm-lz-vending' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout Source Repo
uses: actions/checkout@v4
with:
repository: ${{ env.wiki_source_repo }}
path: ${{ env.wiki_source_repo }}
- name: Checkout Wiki Repo
uses: actions/checkout@v4
with:
repository: ${{ env.wiki_target_repo }}
path: ${{ env.wiki_target_repo }}
- name: Configure Local Git
run: |
git config --global user.name "$github_user_name"
git config --global user.email "$github_email"
working-directory: ${{ env.GITHUB_WORKSPACE }}
- name: Sync docs/wiki Into Wiki Repo
run: |
rsync -avzr --delete --exclude='.git/' "$wiki_source_repo_dir/" "$wiki_target_repo"
working-directory: ${{ env.GITHUB_WORKSPACE }}
- name: Stage & Push Files Into Wiki Repo
run: |
if [ ! "$(git status -s)" ]; then exit 0; fi
git add .
git commit -m "$github_commit_message [$GITHUB_ACTOR/${GITHUB_SHA::8}]"
git push --set-upstream "https://[email protected]/$wiki_target_repo.git" master
working-directory: ${{ env.wiki_target_repo }}