Skip to content

Commit c42c2c6

Browse files
authored
Update search_github.yml
1 parent 69892a0 commit c42c2c6

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1-
# File: .github/workflows/search.yml
2-
name: Cloudflare Worker Repository Search
1+
name: Scheduled Repo Search
32

43
on:
54
schedule:
6-
- cron: '0 0 * * 0' # Weekly, or change to '0 0 * * *' for daily
7-
workflow_dispatch:
5+
# Runs at 00:00 UTC every day. You can adjust the cron schedule as needed.
6+
- cron: '0 0 * * *'
7+
workflow_dispatch: # Allows manual trigger from the Actions UI
8+
9+
# 🚨 CRITICAL FIX: Grant 'write' permissions so the action can push commits back to the repo
10+
permissions:
11+
contents: write
812

913
jobs:
1014
execute-search:
11-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1216
steps:
1317
- name: Checkout repository
1418
uses: actions/checkout@v4
15-
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
1622
- name: Set up Python 3.12
1723
uses: actions/setup-python@v5
1824
with:
1925
python-version: '3.12'
2026
cache: 'pip'
2127
cache-dependency-path: 'scripts/github/workflows/requirements.txt'
22-
28+
2329
- name: Install dependencies
2430
run: |
2531
python -m pip install --upgrade pip
2632
python -m pip install -r scripts/github/workflows/requirements.txt
27-
33+
2834
- name: Run Search Script
2935
env:
3036
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
WORKER_API_URL: ${{ secrets.WORKER_API_URL }} # Add this to your Repo Secrets
37+
WORKER_API_URL: ${{ secrets.WORKER_API_URL }}
3238
run: python scripts/github/workflows/search_repos.py
33-
34-
- name: Upload Search Results Artifact
35-
uses: actions/upload-artifact@v4
39+
40+
# 🚀 NEW: Auto-commit the results.json file back into the repository
41+
- name: Commit and Push Results Locally
42+
uses: stefanzweifel/git-auto-commit-action@v5
3643
with:
37-
name: search-results-json
38-
path: results.json # The script now saves here
39-
if-no-files-found: error
44+
commit_message: "chore(bot): update daily github discovery results"
45+
file_pattern: "results.json"
46+
commit_user_name: "github-actions[bot]"
47+
commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)