Skip to content

Commit 1e13a2b

Browse files
committed
Wiki git does not support PRs, need to push to master
1 parent cb06faa commit 1e13a2b

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

.github/workflows/sync-wiki-docs.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,28 @@ jobs:
3838
continue-on-error: true
3939

4040
- name: Check if wiki checkout succeeded
41+
id: wiki-check
4142
run: |
42-
if [ ! -d "wiki-repo" ] || [ -z "$(ls -A wiki-repo)" ]; then
43+
if [ -d "wiki-repo" ] && [ -n "$(ls -A wiki-repo)" ]; then
44+
echo "wiki_available=true" >> $GITHUB_OUTPUT
45+
else
46+
echo "wiki_available=false" >> $GITHUB_OUTPUT
4347
echo "⚠ Wiki checkout failed - WIKI_PAT may not be configured"
4448
echo "To enable wiki syncing, create a Personal Access Token and add it as WIKI_PAT secret"
45-
exit 0
4649
fi
4750
4851
- name: Set up Python
4952
uses: actions/setup-python@v4
5053
with:
5154
python-version: '3.11'
55+
if: steps.wiki-check.outputs.wiki_available == 'true'
5256

5357
- name: Configure Git for Wiki
5458
run: |
5559
cd wiki-repo
5660
git config user.name "github-actions[bot]"
5761
git config user.email "github-actions[bot]@users.noreply.github.com"
62+
if: steps.wiki-check.outputs.wiki_available == 'true'
5863

5964
- name: Generate and sync documentation
6065
run: |
@@ -65,43 +70,37 @@ jobs:
6570
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
6671
GIT_COMMITTER_NAME: github-actions[bot]
6772
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
73+
if: steps.wiki-check.outputs.wiki_available == 'true'
6874

69-
- name: Create Wiki PR or push if already on main
70-
id: create-wiki-pr
75+
- name: Commit and push to Wiki
76+
id: push-wiki
7177
run: |
7278
cd wiki-repo
7379
7480
# Check if there are changes
7581
if git status --porcelain | grep -q .; then
76-
# Create a branch for the wiki changes
77-
BRANCH_NAME="docs/auto-sync-$(date +%s)"
78-
git checkout -b "$BRANCH_NAME"
7982
git add .
80-
git commit -m "Auto-sync documentation from main branch (commit: ${{ github.sha }})"
83+
git commit -m "Auto-sync documentation from main branch
84+
85+
Source commit: ${{ github.sha }}
86+
Triggered by: ${{ github.event_name }}"
8187
82-
# Push the branch
83-
git push origin "$BRANCH_NAME"
88+
# Push directly to master (wikis don't support PRs)
89+
git push origin master
8490
85-
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
8691
echo "has_changes=true" >> $GITHUB_OUTPUT
8792
else
8893
echo "has_changes=false" >> $GITHUB_OUTPUT
8994
fi
95+
if: steps.wiki-check.outputs.wiki_available == 'true'
9096

91-
- name: Merge and push to Wiki
92-
if: steps.create-wiki-pr.outputs.has_changes == 'true'
93-
run: |
94-
cd wiki-repo
95-
git checkout master
96-
git merge "${{ steps.create-wiki-pr.outputs.branch }}" --no-ff -m "Auto-sync documentation from main branch - Source commit: ${{ github.sha }}, Triggered by: ${{ github.event_name }}"
97-
git push origin master
9897

9998
- name: Report results
10099
if: always()
101100
run: |
102101
echo "✓ Wiki documentation sync workflow completed"
103-
if [ "${{ steps.create-wiki-pr.outputs.has_changes }}" = "true" ]; then
104-
echo "✓ Created Wiki PR that will auto-merge"
102+
if [ "${{ steps.push-wiki.outputs.has_changes }}" = "true" ]; then
103+
echo "✓ Wiki updated with latest documentation"
105104
else
106105
echo "ℹ No documentation changes detected"
107106
fi

0 commit comments

Comments
 (0)