Update CFB Data #322
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
| name: Update CFB Data | |
| on: | |
| schedule: | |
| - cron: "5 4 1 1-8 *" | |
| - cron: "30 6 * 9-12 MON" | |
| - cron: "30 6 * 9-12 SUN" | |
| - cron: "0 16 * 9-12 SAT" | |
| - cron: "15 20 * 9-12 SAT" | |
| - cron: "5 4 * 1,12 *" | |
| repository_dispatch: | |
| types: [daily_cfb_data] | |
| workflow_dispatch: | |
| inputs: | |
| start_year: | |
| required: false | |
| description: "Start Year (e.g., 2023)" | |
| type: string | |
| end_year: | |
| required: false | |
| description: "End Year (e.g., 2023)" | |
| type: string | |
| jobs: | |
| update_cfb_data: | |
| runs-on: ${{ matrix.config.os }} | |
| name: Update CFB Data ${{ inputs.start_year }}-${{ inputs.end_year }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { os: "windows-latest", r: "release" } | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| CFBD_API_KEY: ${{ secrets.CFBD_API_KEY }} | |
| CFB_TEAM_SUMMARIES_TRIGGER_KEY: ${{ secrets.CFB_TEAM_SUMMARIES_TRIGGER_KEY }} | |
| R_KEEP_PKG_SOURCE: yes | |
| START_YEAR: ${{ inputs.start_year }} | |
| END_YEAR: ${{ inputs.end_year }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| . | |
| scripts | |
| .github | |
| betting | |
| data | |
| models | |
| player_stats | |
| R | |
| rosters | |
| schedules | |
| - name: Setting up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.config.r }} | |
| http-user-agent: ${{ matrix.config.http-user-agent }} | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Setting up R dependencies | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| cache-version: 1 | |
| extra-packages: | | |
| sportsdataverse/cfbfastR | |
| sportsdataverse/sportsdataverse-data | |
| ropensci/piggyback | |
| - name: Check cfbfastR_data_trigger for inputs | |
| if: ${{ github.event.client_payload.event_name == 'daily_cfb_data'}} | |
| shell: bash | |
| run: | | |
| echo START_YEAR=$(echo "${{ github.event.client_payload.commit_message}}" | grep -o -E '[0-9]+' | head -1) >> $GITHUB_ENV | |
| echo END_YEAR=$(echo "${{ github.event.client_payload.commit_message}}" | grep -o -E '[0-9]+' | tail -1) >> $GITHUB_ENV | |
| - name: Check for empty inputs | |
| if: ${{ env.START_YEAR == ''}} | |
| shell: bash | |
| run: | | |
| echo START_YEAR=$(Rscript -e "cat(cfbfastR:::most_recent_cfb_season())") >> $GITHUB_ENV | |
| echo END_YEAR=$(Rscript -e "cat(cfbfastR:::most_recent_cfb_season())") >> $GITHUB_ENV | |
| - name: Update CFB Data ${{ env.START_YEAR }}-${{ env.END_YEAR }} | |
| shell: bash | |
| env: | |
| GITHUB_PAT: ${{ secrets.SDV_GH_TOKEN }} | |
| run: | | |
| echo $(pwd) | |
| bash scripts/daily_cfb_R_processor.sh -s ${{ env.START_YEAR }} -e ${{ env.END_YEAR }} | |
| - name: Repository Dispatch | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| token: ${{ secrets.CFB_TEAM_SUMMARIES_TRIGGER_KEY }} | |
| repository: akeaswaran/cfb-team-summaries | |
| event-type: deploy | |
| client-payload: '{"ref": "main"}' |