Files
wp-plugin-starter-template-…/.github/workflows/sync-wiki.yml
marcusquinn 29622dd54c fix: move sync-wiki.yml secrets to env block to resolve SonarCloud S7636
Move github.actor, secrets.GITHUB_TOKEN, and github.repository from
inline run block string interpolation to step-level env: block.
References via env vars prevent secret expansion in workflow logs.

Resolves the remaining S7636 hotspot in sync-wiki.yml.

Closes #106
2026-03-20 07:10:45 +00:00

58 lines
1.5 KiB
YAML

name: Sync Wiki - Update GitHub wiki from .wiki directory
on:
push:
branches:
- main
paths:
- '.wiki/**'
jobs:
sync-wiki:
name: Sync Wiki to GitHub
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout source code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Clone wiki repository
run: |
git clone https://github.com/${{ github.repository }}.wiki.git wiki
- name: Sync wiki content
run: |
# Remove all files from wiki repository except .git
find wiki -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} \;
# Copy .wiki content to wiki repository
cp -r .wiki/* wiki/
# Go to wiki repository
cd wiki
# Add all changes
git add .
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
# Commit changes
git commit -m "Sync wiki from source repository"
# Push changes
git push https://${WIKI_ACTOR}:${WIKI_TOKEN}@github.com/${WIKI_REPO}.wiki.git
env:
WIKI_ACTOR: ${{ github.actor }}
WIKI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WIKI_REPO: ${{ github.repository }}