-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (183 loc) · 10.4 KB
/
main.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Update Data
# Schedule the workflow to run several times a week, and multiple times on Saturdays
on:
schedule:
- cron: '30 8 * * *' # Runs every day at 8:30 GMT (1:30 MT)
- cron: '*/30 20-23 * * 6' # Runs every 30 minutes on Saturday starting at 20:00 GMT (13:00 MT) until 23:00 GMT (16:00 MT)
- cron: '*/30 0-8 * * 0' # Runs every 30 minutes on Sunday starting at 00:00 GMT (Saturday 17:00 MT) until 07:00 GMT (Sunday 01:00 MT)
# Allows manual triggering of the workflow within Github Actions UI
workflow_dispatch:
jobs:
weekly-task:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Dependencies
run: npm install
- name: Use Variables, Check Date and Run Script
env:
AIRTABLE_PERSONAL_ACCESS_TOKEN: ${{ vars.AIRTABLE_PERSONAL_ACCESS_TOKEN }}
AIRTABLE_BASE_ID: ${{ vars.AIRTABLE_BASE_ID }}
AIRTABLE_TABLE_ID: ${{ vars.AIRTABLE_TABLE_ID }}
BASE_API_URL: ${{ vars.BASE_API_URL }}
SEASON_YEAR: ${{ vars.SEASON_YEAR }}
TEAM_API_URL: ${{ vars.TEAM_API_URL }}
SCOREBOARD_API_URL: ${{ vars.SCOREBOARD_API_URL }}
# List of teams & airtable IDs
UAB_Blazers: ${{ vars.UAB_Blazers }}
South_Florida_Bulls: ${{ vars.South_Florida_Bulls }}
Tulsa_Golden_Hurricane: ${{ vars.Tulsa_Golden_Hurricane }}
East_Carolina_Pirates: ${{ vars.East_Carolina_Pirates }}
Temple_Owls: ${{ vars.Temple_Owls }}
Memphis_Tigers: ${{ vars.Memphis_Tigers }}
Rice_Owls: ${{ vars.Rice_Owls }}
North_Texas_Mean_Green: ${{ vars.North_Texas_Mean_Green }}
Army_Black_Knights: ${{ vars.Army_Black_Knights }}
Navy_Midshipmen: ${{ vars.Navy_Midshipmen }}
Florida_Atlantic_Owls: ${{ vars.Florida_Atlantic_Owls }}
Charlotte_49ers: ${{ vars.Charlotte_49ers }}
Tulane_Green_Wave: ${{ vars.Tulane_Green_Wave }}
UTSA_Roadrunners: ${{ vars.UTSA_Roadrunners }}
Stanford_Cardinal: ${{ vars.Stanford_Cardinal }}
California_Golden_Bears: ${{ vars.California_Golden_Bears }}
Florida_State_Seminoles: ${{ vars.Florida_State_Seminoles }}
Georgia_Tech_Yellow_Jackets: ${{ vars.Georgia_Tech_Yellow_Jackets }}
Louisville_Cardinals: ${{ vars.Louisville_Cardinals }}
NC_State_Wolfpack: ${{ vars.NC_State_Wolfpack }}
Boston_College_Eagles: ${{ vars.Boston_College_Eagles }}
Duke_Blue_Devils: ${{ vars.Duke_Blue_Devils }}
Wake_Forest_Demon_Deacons: ${{ vars.Wake_Forest_Demon_Deacons }}
North_Carolina_Tar_Heels: ${{ vars.North_Carolina_Tar_Heels }}
Pittsburgh_Panthers: ${{ vars.Pittsburgh_Panthers }}
Syracuse_Orange: ${{ vars.Syracuse_Orange }}
Virginia_Cavaliers: ${{ vars.Virginia_Cavaliers }}
Clemson_Tigers: ${{ vars.Clemson_Tigers }}
Virginia_Tech_Hokies: ${{ vars.Virginia_Tech_Hokies }}
SMU_Mustangs: ${{ vars.SMU_Mustangs }}
Miami_Hurricanes: ${{ vars.Miami_Hurricanes }}
Arizona_State_Sun_Devils: ${{ vars.Arizona_State_Sun_Devils }}
Colorado_Buffaloes: ${{ vars.Colorado_Buffaloes }}
Arizona_Wildcats: ${{ vars.Arizona_Wildcats }}
Iowa_State_Cyclones: ${{ vars.Iowa_State_Cyclones }}
Baylor_Bears: ${{ vars.Baylor_Bears }}
Oklahoma_State_Cowboys: ${{ vars.Oklahoma_State_Cowboys }}
Utah_Utes: ${{ vars.Utah_Utes }}
Houston_Cougars: ${{ vars.Houston_Cougars }}
BYU_Cougars: ${{ vars.BYU_Cougars }}
UCF_Knights: ${{ vars.UCF_Knights }}
West_Virginia_Mountaineers: ${{ vars.West_Virginia_Mountaineers }}
Cincinnati_Bearcats: ${{ vars.Cincinnati_Bearcats }}
Kansas_Jayhawks: ${{ vars.Kansas_Jayhawks }}
Kansas_State_Wildcats: ${{ vars.Kansas_State_Wildcats }}
TCU_Horned_Frogs: ${{ vars.TCU_Horned_Frogs }}
Texas_Tech_Red_Raiders: ${{ vars.Texas_Tech_Red_Raiders }}
USC_Trojans: ${{ vars.USC_Trojans }}
UCLA_Bruins: ${{ vars.UCLA_Bruins }}
Indiana_Hoosiers: ${{ vars.Indiana_Hoosiers }}
Northwestern_Wildcats: ${{ vars.Northwestern_Wildcats }}
Michigan_State_Spartans: ${{ vars.Michigan_State_Spartans }}
Maryland_Terrapins: ${{ vars.Maryland_Terrapins }}
Michigan_Wolverines: ${{ vars.Michigan_Wolverines }}
Minnesota_Golden_Gophers: ${{ vars.Minnesota_Golden_Gophers }}
Nebraska_Cornhuskers: ${{ vars.Nebraska_Cornhuskers }}
Rutgers_Scarlet_Knights: ${{ vars.Rutgers_Scarlet_Knights }}
Ohio_State_Buckeyes: ${{ vars.Ohio_State_Buckeyes }}
Penn_State_Nittany_Lions: ${{ vars.Penn_State_Nittany_Lions }}
Wisconsin_Badgers: ${{ vars.Wisconsin_Badgers }}
Washington_Huskies: ${{ vars.Washington_Huskies }}
Illinois_Fighting_Illini: ${{ vars.Illinois_Fighting_Illini }}
Iowa_Hawkeyes: ${{ vars.Iowa_Hawkeyes }}
Oregon_Ducks: ${{ vars.Oregon_Ducks }}
Purdue_Boilermakers: ${{ vars.Purdue_Boilermakers }}
Western_Kentucky_Hilltoppers: ${{ vars.Western_Kentucky_Hilltoppers }}
Jacksonville_State_Gamecocks: ${{ vars.Jacksonville_State_Gamecocks }}
New_Mexico_State_Aggies: ${{ vars.New_Mexico_State_Aggies }}
Kennesaw_State_Owls: ${{ vars.Kennesaw_State_Owls }}
Liberty_Flames: ${{ vars.Liberty_Flames }}
Florida_International_Panthers: ${{ vars.Florida_International_Panthers }}
Middle_Tennessee_Blue_Raiders: ${{ vars.Middle_Tennessee_Blue_Raiders }}
Louisiana_Tech_Bulldogs: ${{ vars.Louisiana_Tech_Bulldogs }}
Sam_Houston_Bearkats: ${{ vars.Sam_Houston_Bearkats }}
UTEP_Miners: ${{ vars.UTEP_Miners }}
UConn_Huskies: ${{ vars.UConn_Huskies }}
Notre_Dame_Fighting_Irish: ${{ vars.Notre_Dame_Fighting_Irish }}
Massachusetts_Minutemen: ${{ vars.Massachusetts_Minutemen }}
Bowling_Green_Falcons: ${{ vars.Bowling_Green_Falcons }}
Miami_RedHawks: ${{ vars.Miami_RedHawks }}
Ohio_Bobcats: ${{ vars.Ohio_Bobcats }}
Ball_State_Cardinals: ${{ vars.Ball_State_Cardinals }}
Akron_Zips: ${{ vars.Akron_Zips }}
Central_Michigan_Chippewas: ${{ vars.Central_Michigan_Chippewas }}
Buffalo_Bulls: ${{ vars.Buffalo_Bulls }}
Kent_State_Golden_Flashes: ${{ vars.Kent_State_Golden_Flashes }}
Eastern_Michigan_Eagles: ${{ vars.Eastern_Michigan_Eagles }}
Northern_Illinois_Huskies: ${{ vars.Northern_Illinois_Huskies }}
Western_Michigan_Broncos: ${{ vars.Western_Michigan_Broncos }}
San_Diego_State_Aztecs: ${{ vars.San_Diego_State_Aztecs }}
Toledo_Rockets: ${{ vars.Toledo_Rockets }}
San_Jose_State_Spartans: ${{ vars.San_Jose_State_Spartans }}
Hawaii_Rainbow_Warriors: ${{ vars.Hawaii_Rainbow_Warriors }}
Colorado_State_Rams: ${{ vars.Colorado_State_Rams }}
Boise_State_Broncos: ${{ vars.Boise_State_Broncos }}
New_Mexico_Lobos: ${{ vars.New_Mexico_Lobos }}
Air_Force_Falcons: ${{ vars.Air_Force_Falcons }}
Utah_State_Aggies: ${{ vars.Utah_State_Aggies }}
Fresno_State_Bulldogs: ${{ vars.Fresno_State_Bulldogs }}
Nevada_Wolf_Pack: ${{ vars.Nevada_Wolf_Pack }}
UNLV_Rebels: ${{ vars.UNLV_Rebels }}
Wyoming_Cowboys: ${{ vars.Wyoming_Cowboys }}
Oregon_State_Beavers: ${{ vars.Oregon_State_Beavers }}
Auburn_Tigers: ${{ vars.Auburn_Tigers }}
Washington_State_Cougars: ${{ vars.Washington_State_Cougars }}
Arkansas_Razorbacks: ${{ vars.Arkansas_Razorbacks }}
Georgia_Bulldogs: ${{ vars.Georgia_Bulldogs }}
Kentucky_Wildcats: ${{ vars.Kentucky_Wildcats }}
Florida_Gators: ${{ vars.Florida_Gators }}
LSU_Tigers: ${{ vars.LSU_Tigers }}
Missouri_Tigers: ${{ vars.Missouri_Tigers }}
Oklahoma_Sooners: ${{ vars.Oklahoma_Sooners }}
Ole_Miss_Rebels: ${{ vars.Ole_Miss_Rebels }}
Vanderbilt_Commodores: ${{ vars.Vanderbilt_Commodores }}
Texas_AM_Aggies: ${{ vars.Texas_AM_Aggies }}
Alabama_Crimson_Tide: ${{ vars.Alabama_Crimson_Tide }}
Texas_Longhorns: ${{ vars.Texas_Longhorns }}
South_Carolina_Gamecocks: ${{ vars.South_Carolina_Gamecocks }}
Mississippi_State_Bulldogs: ${{ vars.Mississippi_State_Bulldogs }}
Tennessee_Volunteers: ${{ vars.Tennessee_Volunteers }}
James_Madison_Dukes: ${{ vars.James_Madison_Dukes }}
Marshall_Thundering_Herd: ${{ vars.Marshall_Thundering_Herd }}
Georgia_Southern_Eagles: ${{ vars.Georgia_Southern_Eagles }}
Coastal_Carolina_Chanticleers: ${{ vars.Coastal_Carolina_Chanticleers }}
Old_Dominion_Monarchs: ${{ vars.Old_Dominion_Monarchs }}
App_State_Mountaineers: ${{ vars.App_State_Mountaineers }}
Georgia_State_Panthers: ${{ vars.Georgia_State_Panthers }}
Texas_State_Bobcats: ${{ vars.Texas_State_Bobcats }}
South_Alabama_Jaguars: ${{ vars.South_Alabama_Jaguars }}
Louisiana_Ragin_Cajuns: ${{ vars.Louisiana_Ragin_Cajuns }}
Arkansas_State_Red_Wolves: ${{ vars.Arkansas_State_Red_Wolves }}
UL_Monroe_Warhawks: ${{ vars.UL_Monroe_Warhawks }}
Troy_Trojans: ${{ vars.Troy_Trojans }}
Southern_Miss_Golden_Eagles: ${{ vars.Southern_Miss_Golden_Eagles }}
run: |
# Display insensitive variables
echo "season year: $SEASON_YEAR"
echo "base api url: $BASE_API_URL"
echo "team api url: $TEAM_API_URL"
echo "scoreboard api: $SCOREBOARD_API_URL"
# Get the current date
current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Define start and end dates (Aug 1 - Nov 24, 2024)
start_date="2024-08-01T00:00:00Z"
end_date="2024-11-24T23:59:59Z"
# Compare dates
if [[ "$current_date" > "$start_date" && "$current_date" < "$end_date" ]]; then
echo "Current date is within the specified range. Running the script..."
node airtable.js
else
echo "Current date is outside the specified range. Skipping the task."
fi