-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (93 loc) · 3.02 KB
/
update_ngs.yaml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
on:
schedule:
# runs every day at 7:00 AM UTC = 3AM ET in jan, feb, sep-dec
- cron: '0 7 * 1,2,9-12 *'
workflow_dispatch:
inputs:
season_rebuild:
description: 'Rebuild Season (9999 defaults to latest season)'
required: false
default: 9999
type: number
full_rebuild:
description: 'Full Rebuild (overwrites above season)'
required: true
default: false
type: boolean
name: Update NGS Data
jobs:
ngs_setup:
runs-on: ubuntu-latest
name: ngs_setup
env:
GH_TOKEN: ${{ secrets.NFLVERSE_GH_TOKEN }}
FULL_REBUILD: ${{ inputs.full_rebuild || false }}
SEASON_REBUILD: ${{ inputs.season_rebuild || 9999 }}
outputs:
seasons: ${{ steps.query_seasons.outputs.seasons }}
steps:
- id: query_seasons
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
extra-repositories: 'https://nflverse.r-universe.dev'
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: nflverse/nflreadr
- name: Query Seasons
run: |
if [ $FULL_REBUILD == true ]
then
echo "seasons=$(Rscript -e 'seq(2016, nflreadr::most_recent_season())')" > "$GITHUB_OUTPUT"
elif [ $SEASON_REBUILD == 9999 ]
then
echo "seasons=$(Rscript -e 'nflreadr::most_recent_season()')" > "$GITHUB_OUTPUT"
else
echo "seasons=${{ env.SEASON_REBUILD }}" > "$GITHUB_OUTPUT"
fi
update_ngs_seasons:
needs: ngs_setup
name: Update ${{ matrix.season }} ${{ matrix.type }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
season: ${{ fromJson(needs.pbp_setup.outputs.seasons) }}
type: ["passing", "rushing", "receiving"]
env:
GH_TOKEN: ${{ secrets.NFLVERSE_GH_TOKEN }}
NFLVERSE_UPDATE_SEASON: ${{ matrix.season }}
NFLVERSE_UPDATE_TYPE: ${{ matrix.type }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
extra-repositories: 'https://nflverse.r-universe.dev'
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: nflverse/nflverse-data
- name: Release ${{ matrix.type }}
run: Rscript -e 'source("R/update_ngs.R")'
combine_stats:
needs: [ngs_setup, update_ngs_seasons]
name: Build ${{ matrix.type }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type: ["combine"]
env:
GH_TOKEN: ${{ secrets.NFLVERSE_GH_TOKEN }}
NFLVERSE_UPDATE_TYPE: ${{ matrix.type }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
extra-repositories: 'https://nflverse.r-universe.dev'
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: nflverse/nflverse-data
- name: Release ${{ matrix.type }}
run: Rscript -e 'source("R/update_ngs.R")'