-
Notifications
You must be signed in to change notification settings - Fork 456
60 lines (52 loc) · 2.03 KB
/
platform.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
53
54
55
56
57
58
59
60
# NOTE:
# This pipeline requires a secret 'PLATFORM_REPO_UPDATE_PAT' set up in the GitHub secrets.
# The secret's value should be a PAT token with the permissions to push to the repository's main branch.
name: '.Platform: Sync Docs/Wiki'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docs/wiki/**'
env:
wiki_source_repo: '${{ github.repository }}'
wiki_source_repo_dir: '${{ github.repository }}/docs/wiki'
wiki_target_repo: '${{ github.repository }}.wiki'
github_commit_message: 'Wiki Sync from docs/wiki'
pipelinePrincipalGitUserName: 'CARMLPipelinePrincipal'
pipelinePrincipalGitUserEmail: '[email protected]'
jobs:
sync-wiki:
name: Sync docs/wiki to Wiki
runs-on: ubuntu-latest
steps:
- name: Checkout Source Repo
uses: actions/checkout@v4
with:
repository: ${{ env.wiki_source_repo }}
path: ${{ env.wiki_source_repo }}
token: '${{ secrets.PLATFORM_REPO_UPDATE_PAT }}' # Sets general GIT credentials up
- name: Checkout Wiki Repo
uses: actions/checkout@v4
with:
repository: ${{ env.wiki_target_repo }}
path: ${{ env.wiki_target_repo }}
token: '${{ secrets.PLATFORM_REPO_UPDATE_PAT }}' # Sets general GIT credentials up
- name: Configure Local Git
run: |
git config --global user.name '${{ env.pipelinePrincipalGitUserName }}'
git config --global user.email '${{ env.pipelinePrincipalGitUserEmail }}'
working-directory: ${{ env.GITHUB_WORKSPACE }}
- name: Sync docs/wiki Into Wiki Repo
shell: pwsh
run: |
rsync -avzr --delete --exclude='.git/' "${{ env.wiki_source_repo_dir }}/" "${{ env.wiki_target_repo }}"
working-directory: ${{ env.GITHUB_WORKSPACE }}
- name: Stage & Push Files Into Wiki Repo
shell: pwsh
run: |
git add .
git commit -m "$github_commit_message [$GITHUB_ACTOR/${GITHUB_SHA::8}]"
git push
working-directory: ${{ env.wiki_target_repo }}