diff --git a/.github/workflows/update_data.yaml b/.github/workflows/update_data.yaml index da1932fb..19203d51 100644 --- a/.github/workflows/update_data.yaml +++ b/.github/workflows/update_data.yaml @@ -14,7 +14,7 @@ on: workflow_dispatch: inputs: season_rebuild: - description: 'Rebuild Season (9999 defaults to latest season)' + description: 'Rebuild Season (9999 defaults to latest season). Do multiple seasons comma separated, e.g. 2017,2019,2021' required: false default: 9999 type: number @@ -37,17 +37,26 @@ jobs: 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 - echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[.[].tagName | match("\\d+") | .string ]')" > "$GITHUB_OUTPUT" + seasons=$( Rscript -e 'nflverse.workflows::get_season_range(1999)' ) elif [ $SEASON_REBUILD == 9999 ] then - echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[[.[].tagName | match("\\d+") | .string ] | max]')" > "$GITHUB_OUTPUT" + seasons=$( Rscript -e 'nflverse.workflows::get_current_season()' ) else - echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[.[].tagName | select(endswith(${{ env.SEASON_REBUILD }} | tostring)) | match("\\d+") | .string]')" > "$GITHUB_OUTPUT" + seasons="[$SEASON_REBUILD]" fi + echo "seasons=$seasons" >> "$GITHUB_OUTPUT" + update_pbp: needs: pbp_setup