-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·92 lines (80 loc) · 2.99 KB
/
Copy pathdaily_wbb.yml
File metadata and controls
executable file
·92 lines (80 loc) · 2.99 KB
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
name: Update WBB Data
on:
schedule:
- cron: '0 7 18-31 10 *' # late October (season opens)
- cron: '0 7 * 11-12 *' # November - December
- cron: '0 7 * 1-3 *' # January - March (regular season + conf tourneys)
- cron: '0 7 1-12 4 *' # early April (NCAA tournament tail)
repository_dispatch:
types: [daily_wbb_data]
workflow_dispatch:
inputs:
start_year:
required: false
type: string
end_year:
required: false
type: string
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
update_wbb_data:
runs-on: ${{ matrix.config.os }}
name: Update WBB Data ${{ inputs.start_year }}-${{ inputs.end_year }}
strategy:
fail-fast: false
matrix:
config:
- {os: 'windows-latest', r: 'release'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
START_YEAR: ${{ inputs.start_year }}
END_YEAR: ${{ inputs.end_year }}
steps:
- name: Checkout repo
uses: actions/checkout@v6
- 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/wehoop
sportsdataverse/sportsdataverse-data
ropensci/piggyback
- name: Extract years from trigger dispatch
if: ${{ github.event.client_payload.event_name == 'daily_wbb_data' }}
shell: bash
env:
COMMIT_MESSAGE: ${{ github.event.client_payload.commit_message }}
run: |
# `Start:\s*\K[0-9]{4}` anchors to the canonical token in the
# upstream `WBB Raw Update (Start: YYYY End: YYYY)` commit
# message so embedded numbers (PR ids, run ids, error codes)
# don't shadow the year extraction.
start=$(printf '%s' "$COMMIT_MESSAGE" | grep -oP 'Start:\s*\K[0-9]{4}' | head -1)
end=$(printf '%s' "$COMMIT_MESSAGE" | grep -oP 'End:\s*\K[0-9]{4}' | head -1)
echo "START_YEAR=$start" >> $GITHUB_ENV
echo "END_YEAR=$end" >> $GITHUB_ENV
- name: Default year inputs if empty
if: ${{ env.START_YEAR == '' }}
shell: bash
run: |
echo "START_YEAR=$(Rscript -e 'cat(wehoop::most_recent_wbb_season())')" >> $GITHUB_ENV
echo "END_YEAR=$(Rscript -e 'cat(wehoop::most_recent_wbb_season())')" >> $GITHUB_ENV
- name: Update WBB Data ${{ env.START_YEAR }}-${{ env.END_YEAR }}
shell: bash
env:
GITHUB_PAT: ${{ secrets.SDV_GH_TOKEN }}
SPORTSDATAVERSE.UPLOAD.QUIET: FALSE
SPORTSDATAVERSE.UPLOAD.MAX_TIMES: 20
run: |
bash scripts/daily_wbb_R_processor.sh -s ${{ env.START_YEAR }} -e ${{ env.END_YEAR }}