mirror of
https://github.com/acamarata/nrel-spa.git
synced 2026-06-30 19:04:25 +00:00
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: Sync Wiki
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['.github/wiki/**']
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Checkout wiki
|
|
run: |
|
|
git clone "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git" .wiki-remote \
|
|
|| (mkdir -p .wiki-remote \
|
|
&& cd .wiki-remote \
|
|
&& git init \
|
|
&& git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git")
|
|
|
|
- name: Sync wiki pages
|
|
run: |
|
|
# Copy root wiki pages
|
|
cp .github/wiki/*.md .wiki-remote/
|
|
# Copy subdirectory pages (api/, benchmarks/, guides/, examples/)
|
|
for dir in api benchmarks guides examples; do
|
|
if [ -d ".github/wiki/$dir" ]; then
|
|
mkdir -p ".wiki-remote/$dir"
|
|
cp ".github/wiki/$dir"/*.md ".wiki-remote/$dir/" 2>/dev/null || true
|
|
fi
|
|
done
|
|
cd .wiki-remote
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add -A
|
|
if git diff --cached --quiet; then
|
|
echo "No wiki changes to commit"
|
|
else
|
|
git commit -m "Sync wiki from repo"
|
|
git push
|
|
fi
|