11name : Sync-Wiki
22
3- on : push
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - " **/*.md"
9+ - " .github/workflows/sync-wiki.yml"
10+ - " .github/workflows/markdownList.yml"
11+ - " .github/scripts/sync-wiki.py"
12+ workflow_dispatch :
413
514jobs :
615 sync-wiki :
@@ -10,14 +19,12 @@ jobs:
1019 uses : actions/checkout@v3
1120 with :
1221 path : repo
13-
1422 - name : Checkout Wiki
1523 uses : actions/checkout@v3
1624 with :
1725 repository : ${{ github.repository }}.wiki
1826 path : wiki
1927 continue-on-error : true
20-
2128 - name : Create Wiki Directory if Not Exists
2229 run : |
2330 if [ ! -d "wiki" ]; then
@@ -28,29 +35,25 @@ jobs:
2835 git config user.email "${{ github.actor }}@users.noreply.github.com"
2936 git remote add origin "https://github.com/${{ github.repository }}.wiki.git"
3037 fi
31-
3238 - name : Set up Python
3339 uses : actions/setup-python@v4
3440 with :
3541 python-version : ' 3.10'
36-
3742 - name : Install dependencies
3843 run : pip install pyyaml
39-
4044 - name : Sync markdown files to Wiki
4145 run : |
4246 python $GITHUB_WORKSPACE/repo/.github/scripts/sync-wiki.py
4347 env :
4448 GITHUB_REPOSITORY : ${{ github.repository }}
45-
4649 - name : Push changes to wiki
4750 run : |
4851 cd wiki
4952 git config user.name "${{ github.actor }}"
5053 git config user.email "${{ github.actor }}@users.noreply.github.com"
5154 git add .
5255 if git status --porcelain | grep .; then
53- git commit -m "Auto sync wiki from main repository"
56+ git commit -m "Auto sync wiki from main repository"
5457 git push --set-upstream https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.wiki.git master -f
5558 else
5659 echo "No changes to commit"
0 commit comments