Update Google Scholar Stats #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Google Scholar Stats | |
| on: | |
| schedule: | |
| # 每天 UTC 03:00(北京时间 11:00)运行 | |
| - cron: '0 3 * * *' | |
| workflow_dispatch: # 允许在 Actions 页面手动触发 | |
| push: | |
| paths: | |
| - 'update-scholar.py' | |
| - '.github/workflows/update-scholar.yml' | |
| permissions: | |
| contents: write # 允许把更新后的 scholar.json 提交回仓库 | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Fetch latest Scholar stats (via SerpAPI) | |
| env: | |
| SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} | |
| run: python update-scholar.py | |
| - name: Commit & push if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if git diff --quiet scholar.json; then | |
| echo "No changes to scholar.json — skip commit." | |
| else | |
| git add scholar.json | |
| git commit -m "chore: auto-update Google Scholar stats" | |
| git push | |
| fi |