name: Collect GitHub Trending Data on: schedule: # Run every day at 00:00 UTC (可根据需要调整时间) - cron: '0 0 * * *' # Allow manual trigger workflow_dispatch: inputs: language: description: 'Programming language filter (leave empty for all)' required: false default: '' since: description: 'Time range' required: false default: 'daily' type: choice options: - daily - weekly - monthly jobs: collect: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Collect trending data (All languages) run: | python collector.py --since daily --format both --output-dir data - name: Collect trending data (Python) run: | python collector.py --language python --since daily --format both --output-dir data - name: Collect trending data (JavaScript) run: | python collector.py --language javascript --since daily --format both --output-dir data - name: Collect trending data (Go) run: | python collector.py --language go --since daily --format both --output-dir data - name: Commit and push data run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add data/ # Check if there are changes to commit if git diff --staged --quiet; then echo "No changes to commit" else git commit -m "chore: update trending data $(date +'%Y-%m-%d %H:%M:%S')" git push fi