Refresh portfolio data #63
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: Refresh portfolio data | |
| on: | |
| schedule: | |
| # 每 6 小时自动重新抓取 GitHub 数据并更新 data.js | |
| - cron: '17 */6 * * *' | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Build data.js from GitHub API | |
| run: python _data/build.py | |
| env: | |
| # 内置 token:让 API 调用使用 5000 次/小时配额,并支持 compare 补全真实提交数 | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Commit and push if changed | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: 'chore: auto refresh portfolio data' | |
| commit_user_name: 'github-actions[bot]' | |
| commit_user_email: 'github-actions[bot]@users.noreply.github.com' |