Skip to content

同步作者信息

同步作者信息 #25

Workflow file for this run

name: 同步作者信息
on:
schedule:
# 每天北京时间 18:30 运行 (UTC 10:30)
- cron: '30 10 * * *'
workflow_dispatch: # 允许手动触发
jobs:
sync-authors:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 设置 Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: 安装依赖
run: npm install
- name: 同步作者信息
run: node build/sync_authors.js
- name: 检查文件变更
id: verify-changed-files
run: |
# 检查 author_mapping.json 是否有变更
if git diff --quiet assets/author_mapping.json; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "assets/author_mapping.json 没有变更"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "assets/author_mapping.json 有变更"
fi
- name: 提交变更
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add assets/author_mapping.json
git commit -m "自动更新作者映射信息 [skip ci]"
git push
- name: 无变更提示
if: steps.verify-changed-files.outputs.changed == 'false'
run: |
echo "assets/author_mapping.json 没有变更,跳过提交"