Scheduled Repo Search #66
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: Scheduled Repo Search | |
| on: | |
| schedule: | |
| # Runs at 00:00 UTC every day. You can adjust the cron schedule as needed. | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: # Allows manual trigger from the Actions UI | |
| # 🚨 CRITICAL FIX: Grant 'write' permissions so the action can push commits back to the repo | |
| permissions: | |
| contents: write | |
| jobs: | |
| execute-search: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: 'scripts/github/workflows/requirements.txt' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r scripts/github/workflows/requirements.txt | |
| - name: Run Search Script | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WORKER_API_URL: ${{ secrets.WORKER_API_URL }} | |
| run: python scripts/github/workflows/search_repos.py | |
| # 🚀 NEW: Auto-commit the results.json file back into the repository | |
| - name: Commit and Push Results Locally | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore(bot): update daily github discovery results" | |
| file_pattern: "results.json" | |
| commit_user_name: "github-actions[bot]" | |
| commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com" |