2021-08-16 14:00:37 +03:00
|
|
|
name: Docs/Wiki Sync
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- "docs/wiki/**"
|
|
|
|
|
|
|
|
env:
|
|
|
|
wiki_source_repo: "Azure/ALZ-Bicep"
|
|
|
|
wiki_source_repo_dir: "Azure/ALZ-Bicep/docs/wiki"
|
|
|
|
wiki_target_repo: "Azure/ALZ-Bicep.wiki"
|
|
|
|
github_user_name: "github-actions"
|
|
|
|
github_email: "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
github_commit_message: "Wiki Sync from docs/wiki"
|
|
|
|
|
2024-10-08 02:19:45 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2021-08-16 14:00:37 +03:00
|
|
|
jobs:
|
|
|
|
sync-wiki:
|
|
|
|
name: Sync docs/wiki to Wiki
|
|
|
|
if: github.repository == 'Azure/ALZ-Bicep'
|
|
|
|
runs-on: ubuntu-latest
|
2024-02-08 08:47:40 +03:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
2021-08-16 14:00:37 +03:00
|
|
|
steps:
|
2024-10-08 02:19:45 +03:00
|
|
|
- name: Harden Runner
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
|
2021-08-16 14:00:37 +03:00
|
|
|
- name: Checkout Source Repo
|
2024-11-04 21:27:25 +03:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2021-08-16 14:00:37 +03:00
|
|
|
with:
|
|
|
|
repository: ${{ env.wiki_source_repo }}
|
|
|
|
path: ${{ env.wiki_source_repo }}
|
|
|
|
|
|
|
|
- name: Checkout Wiki Repo
|
2024-11-04 21:27:25 +03:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2021-08-16 14:00:37 +03:00
|
|
|
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: |
|
|
|
|
git add .
|
|
|
|
git commit -m "$github_commit_message [$GITHUB_ACTOR/${GITHUB_SHA::8}]"
|
|
|
|
git push --set-upstream https://$GITHUB_TOKEN@github.com/$wiki_target_repo.git master
|
|
|
|
working-directory: ${{ env.wiki_target_repo }}
|