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 }}