From a2bb491e06e9efdf5b9452acc7aff90762e5bc00 Mon Sep 17 00:00:00 2001 From: mrcaseb <38586519+mrcaseb@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:01:19 +0100 Subject: [PATCH] Setup sets inputs as env vars with a default (#90) * set inputs as env vars with defaults to work with scheduled workflows * maybe no curly braces * maybe the jq string requires the curly braces idk what I am doing * prefix might help * laterals are just a summary of play stats (#91) --- .github/workflows/update_data.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_data.yaml b/.github/workflows/update_data.yaml index feb4686c..18df1396 100644 --- a/.github/workflows/update_data.yaml +++ b/.github/workflows/update_data.yaml @@ -19,7 +19,7 @@ on: default: 9999 type: number full_rebuild: - description: 'Full Rebuild' + description: 'Full Rebuild (overwrites above season)' required: true default: false type: boolean @@ -32,19 +32,21 @@ jobs: 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: - id: query_seasons run: | - if [ ${{ inputs.full_rebuild }} == true ] + if [ $FULL_REBUILD == true ] then echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[.[].tagName | match("\\d+") | .string ]')" > "$GITHUB_OUTPUT" - elif [ ${{ inputs.season_rebuild }} == 9999 ] + elif [ $SEASON_REBUILD == 9999 ] then echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[[.[].tagName | match("\\d+") | .string ] | max]')" > "$GITHUB_OUTPUT" else - echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[.[].tagName | select(endswith(${{ inputs.season_rebuild }} | tostring)) | match("\\d+") | .string]')" > "$GITHUB_OUTPUT" + echo "seasons=$(gh release list -R nflverse/nflverse-pbp --json tagName --jq '[.[].tagName | select(endswith(${{ env.SEASON_REBUILD }} | tostring)) | match("\\d+") | .string]')" > "$GITHUB_OUTPUT" fi update_pbp: