diff --git a/.github/workflows/publish_docs_to_wiki.yml b/.github/workflows/publish_docs_to_wiki.yml index a5c74b84d6..0bdd8fc8fa 100644 --- a/.github/workflows/publish_docs_to_wiki.yml +++ b/.github/workflows/publish_docs_to_wiki.yml @@ -6,14 +6,20 @@ on: paths: - docs/** # This includes all sub folders branches: - - master # This can be changed to any branch of your preference + - master # Publish wiki on merge to master + workflow_dispatch: + inputs: + dry_run: + description: "Run sync and commit checks without pushing to wiki" + required: true + default: true + type: boolean env: WIKI_TOKEN: ${{ secrets.WIKI_ACTION_TOKEN }} # Personal Access Token with repo scope USER_NAME: "GitHub Actions" # Enter the username of your (bot) account USER_EMAIL: "actions@github.com" # Enter the e-mail of your (bot) account - OWNER: ${{ github.event.repository.owner.name }} # This is the repository owner - REPOSITORY_NAME: ${{ github.event.repository.name }} # This is the repository name + REPOSITORY: ${{ github.repository }} # owner/repository jobs: publish_docs_to_wiki: @@ -28,13 +34,15 @@ jobs: # 3. Pull old Wiki content - name: Pull content from wiki run: | + [[ -n "$WIKI_TOKEN" ]] || { echo "WIKI_ACTION_TOKEN is empty or not set"; exit 1; } mkdir tmp_wiki cd tmp_wiki git init - git pull https://$WIKI_TOKEN@github.com/$OWNER/$REPOSITORY_NAME.wiki.git + git pull https://x-access-token:$WIKI_TOKEN@github.com/$REPOSITORY.wiki.git # 4. Synchronize differences between `docs` & `tmp_wiki` # 5. Push new Wiki content - name: Push content to wiki + if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run == false }} run: | rsync -av --delete docs/ tmp_wiki/ --exclude .git cd tmp_wiki @@ -42,4 +50,17 @@ jobs: git config user.email "$USER_EMAIL" git add . git commit -m "Update Wiki content" || echo "No changes to commit" - git push -f --set-upstream https://$WIKI_TOKEN@github.com/$OWNER/$REPOSITORY_NAME.wiki.git master + git push -f --set-upstream https://x-access-token:$WIKI_TOKEN@github.com/$REPOSITORY.wiki.git master + + - name: Dry-run summary + if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == true }} + run: | + rsync -av --delete docs/ tmp_wiki/ --exclude .git + cd tmp_wiki + git add . + if git diff --cached --quiet; then + echo "Dry-run: no wiki changes detected." + else + echo "Dry-run: wiki changes detected and staged (no push performed)." + git status --short + fi diff --git a/docs/Home.md b/docs/Home.md index 06d68608d1..ccf243d2d0 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -4,4 +4,4 @@ Die komplette Anleitung und Nutzerdokumentation für openWB software2 findet Ihr Auch Ihr als Community könnt an den Artikeln im Wiki für Endanwender mitwirken. Sendet dazu einen Artikel-Vorschlag oder einen Textvorschlag (gerne auch mit Bildern) zur Aktualisierung bzw. Korrektur an unseren Support unter [support@openwb.de](mailto:support@openwb.de). -Hier im GitHub-Wiki findet Ihr ausschließlich technische Informationen für Entwickler, wie Ihr mit euren eigenen Pull Requests zur Weiterentwicklung des openWB-Codes beitragen könnt. \ No newline at end of file +Hier im GitHub-Wiki findet Ihr ausschließlich technische Informationen für Entwickler, wie Ihr mit euren eigenen Pull Requests zur Weiterentwicklung des openWB-Codes beitragen könnt. \ No newline at end of file