Files
Tracker-api/.github/workflows/daily-tracker-sync.yml
Hsdi 04438bbd56
All checks were successful
Daily Tracker Sync / update-list (release) Successful in 1m59s
Daily Tracker Sync / update-list (push) Successful in 26s
更新每日追踪器同步工作流,升级 Node.js 版本并优化提交逻辑
2026-03-16 03:18:36 +08:00

55 lines
1.3 KiB
YAML

name: Daily Tracker Sync
on:
schedule:
- cron: '0 0 * * *' # Daily at 00:00 UTC
workflow_dispatch:
release:
types:
- published
permissions:
contents: write
jobs:
update-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Resolve output file
id: output
shell: bash
run: echo "file=list/$(date -u +%F).txt" >> "$GITHUB_OUTPUT"
- name: Run sync script
run: node sync-trackers.js
- name: Commit and push list changes
if: github.event_name != 'release' && github.ref == 'refs/heads/main'
shell: bash
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add list/
git diff --cached --quiet || (
git commit -m "Update tracker list: $(date -u +%F)"
git push origin HEAD:main
)
- name: Upload file to release assets
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.output.outputs.file }}
overwrite_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}