diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml index 9bf230d3..bb267849 100644 --- a/.github/workflows/sync-wiki.yml +++ b/.github/workflows/sync-wiki.yml @@ -25,6 +25,17 @@ jobs: with: repository: ${{ github.repository }}.wiki path: wiki + continue-on-error: true + - name: Create Wiki Directory if Not Exists + run: | + if [ ! -d "wiki" ]; then + mkdir -p wiki + cd wiki + git init + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + git remote add origin "https://github.com/${{ github.repository }}.wiki.git" + fi - name: Set up Python uses: actions/setup-python@v4 with: @@ -42,5 +53,9 @@ jobs: git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git add . - git diff --quiet && git diff --staged --quiet || \ - (git commit -m "Auto sync wiki from main repository" && git push) + if git status --porcelain | grep .; then + git commit -m "Auto sync wiki from main repository" + git push --set-upstream https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.wiki.git master -f + else + echo "No changes to commit" + fi