Update PBP Related Data #682
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| schedule: | |
| # Every day at 9:00 UTC/5:00 ET | |
| - cron: '0 9 * 1,2,9-12 *' | |
| # TNF 5:30 AM UTC / 12:30 AM ET | |
| - cron: '30 5 * 1,2,9-12 5' | |
| # Early window: 10:00 PM UTC / 5:00 PM ET | |
| - cron: '00 22 * 1,2,9-12 0' | |
| # Late window: 0:00 UTC / 8:00 ET | |
| - cron: '5 0 * 1,2,9-12 1' | |
| # SNF/MNF: 5:30 UTC / 12:30 ET | |
| - cron: '30 5 * 1,2,9-12 1' | |
| - cron: '30 5 * 1,2,9-12 2' | |
| workflow_dispatch: | |
| inputs: | |
| season_rebuild: | |
| description: 'Rebuild Season (9999 defaults to latest season). Do multiple seasons comma separated, e.g. 2017,2019,2021' | |
| required: false | |
| default: 9999 | |
| type: number | |
| full_rebuild: | |
| description: 'Full Rebuild (overwrites above season)' | |
| required: true | |
| default: false | |
| type: boolean | |
| name: Update PBP Related Data | |
| jobs: | |
| pbp_setup: | |
| runs-on: ubuntu-latest | |
| name: pbp_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: | |
| - uses: r-lib/actions/setup-r@v2 | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| packages: nflverse/nflverse-workflows | |
| - id: query_seasons | |
| name: Query Seasons | |
| run: | | |
| if [ $FULL_REBUILD == true ] | |
| then | |
| seasons=$( Rscript -e 'nflverse.workflows::get_season_range(1999)' ) | |
| elif [ $SEASON_REBUILD == 9999 ] | |
| then | |
| seasons=$( Rscript -e 'nflverse.workflows::get_current_season()' ) | |
| else | |
| seasons="[$SEASON_REBUILD]" | |
| fi | |
| echo "seasons=$seasons" >> "$GITHUB_OUTPUT" | |
| update_pbp: | |
| needs: pbp_setup | |
| name: Update ${{ matrix.season }} ${{ matrix.type }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| season: ${{ fromJson(needs.pbp_setup.outputs.seasons) }} | |
| type: ["pbp", "pbp_stats"] | |
| 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: | |
| cache-version: 1 | |
| extra-packages: | | |
| nflverse/nflverse-data | |
| nflverse/fastrmodels | |
| cran/xgboost@1.7.11.1 | |
| qsbase/qs | |
| - name: Release ${{ matrix.type }} | |
| run: Rscript -e 'source("R/update_data.R")' | |
| update_stats: | |
| needs: [pbp_setup, update_pbp] | |
| name: Update ${{ matrix.season }} ${{ matrix.type }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| season: ${{ fromJson(needs.pbp_setup.outputs.seasons) }} | |
| type: ["stats"] | |
| env: | |
| GH_TOKEN: ${{ secrets.NFLVERSE_GH_TOKEN }} | |
| GITHUB_PAT: ${{ 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: | |
| cache-version: 1 | |
| extra-packages: | | |
| nflverse/nflverse-data | |
| nflverse/fastrmodels | |
| qsbase/qs | |
| - name: Release ${{ matrix.type }} | |
| run: Rscript -e 'source("R/update_data.R")' | |
| combine_stats: | |
| needs: [pbp_setup, update_stats] | |
| name: Build ${{ matrix.type }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| type: ["laterals"] | |
| 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: | |
| cache-version: 1 | |
| extra-packages: | | |
| nflverse/nflverse-data | |
| nflverse/fastrmodels | |
| qsbase/qs | |
| - name: Release ${{ matrix.type }} | |
| run: Rscript -e 'source("R/update_data.R")' |