Update Visit Statistics #8605
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 Visit Statistics | |
| permissions: | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # 增加频率:每15分钟运行一次 | |
| - cron: '*/15 * * * *' | |
| # 每天UTC时间00:00运行(累计访问统计和重置今日访问) | |
| - cron: '0 0 * * *' | |
| jobs: | |
| update-stats: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Python dependencies | |
| run: pip install requests | |
| - name: Update visit statistics | |
| run: python .github/scripts/update_stats.py | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "actions@github.com" | |
| git config --local user.name "CFCAT" | |
| git add stats/visit_stats.json | |
| git diff --staged --quiet || git commit -m "CFCAT: 我来更新网站的统计信息啦😄" | |
| git push |