Repository navigation
63 lines (50 loc) · 1.97 KB
/
Copy pathjoin-data.yml
File metadata and controls
63 lines (50 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Join Data
# Runs join_data.ipynb to combine application data with events and generate
# Pharmac applications.xlsx with Outcome__c and Summary__c fields extracted
# from application JSON files.
on:
workflow_dispatch: # Allow manual triggering
schedule:
# Run weekly on Mondays at 01:00 UTC
- cron: '0 1 * * 1'
concurrency:
group: join-data
cancel-in-progress: false
jobs:
join-data:
name: Run join_data.ipynb
runs-on: ubuntu-latest
# Normal runs take ~5 min (occasionally ~100); without a timeout a hung
# run holds the runner for the full 6h job limit.
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Install Jupyter
run: pip install jupyter nbconvert
- name: Run join_data.ipynb
run: jupyter nbconvert --to notebook --execute join_data.ipynb --inplace
env:
PYTHONUNBUFFERED: '1'
- name: Render notebook as HTML
run: jupyter nbconvert --to html join_data.ipynb --output index.html
- name: Commit updated files
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add "Pharmac applications.xlsx" index.html join_data.ipynb
git diff --staged --quiet && echo "No changes to commit" && exit 0
# Count rows in the Excel file
ROWS=$(python3 -c "import pandas as pd; df = pd.read_excel('Pharmac applications.xlsx'); print(len(df))")
git commit -m "Update Pharmac applications.xlsx: ${ROWS} applications [skip ci]"
git pull --rebase
git push