1+ name : Weekly PFD Top-Up
2+
3+ on :
4+ workflow_dispatch :
5+ # Automatically trigger every Monday at 1:00 AM UTC
6+ schedule :
7+ - cron : ' 0 1 * * 1' # ...Format: Minute Hour Day Month Weekday (UTC timezone)
8+
9+ permissions :
10+ contents : write
11+
12+ jobs :
13+ scrape :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Check if on main branch # ...exit if not on main branch
18+ if : github.ref != 'refs/heads/main'
19+ run : |
20+ echo "This workflow is designed to run on main only."
21+ exit 0
22+
23+ - name : Checkout Repository Code
24+ uses : actions/checkout@v4
25+
26+ - name : Install UV
27+ uses : astral-sh/setup-uv@v5
28+ with :
29+ enable-cache : true # ...caches installed dependencies for faster subsequent runs
30+ cache-dependency-glob : " uv.lock" # ...cache is invalidated if uv.lock changes
31+
32+ - name : Set up Python
33+ uses : actions/setup-python@v5
34+ with :
35+ python-version-file : " pyproject.toml"
36+
37+ - name : Install Project Dependencies via UV
38+ run : uv sync
39+
40+
41+ - name : Run the PFD Top-Up Script
42+ run : uv run python scripts/update_reports.py
43+
44+ - name : Display Summary in Actions UI
45+ if : always()
46+ run : |
47+ summary=".github/workflows/update_summary.txt"
48+ echo "### 📊 PFD Reports Summary" >> $GITHUB_STEP_SUMMARY
49+ if [ -f "$summary" ]; then
50+ cat "$summary" >> $GITHUB_STEP_SUMMARY
51+ else
52+ echo "ℹ️ You have commitment issues! (No new reports found)" >> $GITHUB_STEP_SUMMARY
53+ fi
54+
55+ - name : Commit & Push Changes
56+ if : github.ref == 'refs/heads/main'
57+ uses : EndBug/add-and-commit@v9
58+ with :
59+ add : src/pfd_toolkit/data/all_reports.csv
60+ default_author : github_actions
61+ message : " 🤖 Weekly PFD data top-up"
0 commit comments