Update Data #573
This file contains 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 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 |