Files
Ydisks-Xianyu-Helper/.github/workflows/sync-wiki.yml

49 lines
1.3 KiB
YAML

name: 同步 GitHub Wiki
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
concurrency:
group: sync-wiki-main
cancel-in-progress: true
jobs:
sync:
name: 同步仓库 Wiki 页面
runs-on: ubuntu-latest
steps:
- name: 检出主分支文档
uses: actions/checkout@v4
with:
ref: main
- name: 克隆 GitHub Wiki 仓库
env:
WIKI_REPOSITORY: https://x-access-token:${{ github.token }}@github.com/Christ9038/Ydisks-Xianyu-Helper.wiki.git
run: git clone "$WIKI_REPOSITORY" wiki
- name: 镜像 Wiki 页面
run: rsync -a --delete --exclude='.git' docs/wiki/ wiki/
- name: 提交并推送 Wiki
working-directory: wiki
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
git add --all
if git diff --cached --quiet; then
echo "Wiki 内容没有变化。"
exit 0
fi
git commit -m "docs: 同步项目 Wiki"
git push origin HEAD:master