Skip to content

Commit c0acac0

Browse files
committed
Revised github action
1 parent fb26889 commit c0acac0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/load-weekly-data.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ on:
88
required: false
99
default: "2024"
1010
week:
11-
description: "Week number or 'current'"
11+
description: "Week number (leave blank for all)"
1212
required: false
13-
default: "current"
13+
default: ""
1414
schedule:
1515
- cron: '0 10 * * TUE'
1616

1717
jobs:
1818
load:
1919
runs-on: ubuntu-latest
20-
env:
21-
SEASON: ${{ inputs.season }}
22-
WEEK: ${{ inputs.week }}
2320
steps:
2421
- name: Checkout repository
2522
uses: actions/checkout@v4
@@ -35,9 +32,13 @@ jobs:
3532
python -m pip install --upgrade pip
3633
pip install -r requirements.txt -r requirements-dev.txt
3734
38-
- name: Run weekly loader (nfl_data_py)
35+
- name: Run weekly loader (nflreadpy/nfl_data_py)
36+
shell: bash
3937
run: |
40-
python scripts/load_weekly_data.py --season "${{ inputs.season }}" --week "${{ inputs.week }}" --output nfl_weekly_stats.csv
38+
ARGS=( )
39+
if [ -n "${{ inputs.season }}" ]; then ARGS+=(--season "${{ inputs.season }}"); fi
40+
if [ -n "${{ inputs.week }}" ]; then ARGS+=(--week "${{ inputs.week }}"); fi
41+
python scripts/load_weekly_data.py "${ARGS[@]}" --output nfl_weekly_stats.csv
4142
4243
- name: Upload CSV artifact
4344
if: success()
@@ -47,7 +48,7 @@ jobs:
4748
path: nfl_weekly_stats.csv
4849

4950
- name: Load CSV into Postgres (optional)
50-
if: ${{ success() && env.PGHOST && env.PGUSER && env.PGDATABASE }}
51+
if: ${{ success() && secrets.PGHOST && secrets.PGUSER && secrets.PGDATABASE }}
5152
env:
5253
PGHOST: ${{ secrets.PGHOST }}
5354
PGPORT: ${{ secrets.PGPORT }}

0 commit comments

Comments
 (0)