Nightly Data Update #104
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: 'Nightly Data Update' | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 9 * * *' # once a day at 9:00 AM UTC / 4:00 AM EST | |
jobs: | |
# A helpful guide on installing poetry in Github Actions can be found here: | |
# https://jacobian.org/til/github-actions-poetry/ | |
set_up_environment: | |
name: Set up environment | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./util | |
steps: | |
- name: Check out default branch | |
uses: actions/checkout@v4 | |
# Cache the poetry installation so it doesn't need to be installed every run. | |
- name: cache poetry install | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
key: poetry-1.5.1 | |
# Install Poetry and pin the version to 1.5.1. | |
# Setting `virtualenvs-in-project: true` allows the next step to easily cache it. | |
# snok/install-poetry is version pinned to v1.3.4 because it works, and setting to v1 | |
# would result in always pulling the latest. Upgrading this version number manually is | |
# preferred in case of regressions introduced in this dependency. | |
- uses: snok/[email protected] | |
with: | |
version: 1.5.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
# Install dependencies. `--no-root` means "install all dependencies but not the project | |
# itself", which is what you want to avoid caching _your_ code. The `if` statement | |
# ensures this only runs on a cache miss. | |
- run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
# Load all the blue banners that have been won since the current year. | |
load_blue_banners: | |
name: Load Blue Banners | |
needs: set_up_environment | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./util | |
steps: | |
- name: Check out default branch | |
uses: actions/checkout@v4 | |
# Load the cached poetry install from the environment set up step. | |
- name: cache poetry install | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
key: poetry-1.5.1 | |
# Install dependencies. `--no-root` means "install all dependencies but not the project | |
# itself", which is what you want to avoid caching _your_ code. The `if` statement | |
# ensures this only runs on a cache miss. | |
- run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
- name: Update blue banner data | |
run: poetry run python main.py banner --banner_mode=since_current_year --credentials=${{ secrets.DATA_UPDATE_CREDENTIALS }} | |
# Load all the events and update their data. | |
load_event_data: | |
name: Load Event Data | |
needs: [set_up_environment, load_blue_banners] | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./util | |
steps: | |
- name: Check out default branch | |
uses: actions/checkout@v4 | |
# Load the cached poetry install from the environment set up step. | |
- name: cache poetry install | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
key: poetry-1.5.1 | |
# Install dependencies. `--no-root` means "install all dependencies but not the project | |
# itself", which is what you want to avoid caching _your_ code. The `if` statement | |
# ensures this only runs on a cache miss. | |
- run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
- name: Update event data | |
run: poetry run python main.py event --event_mode=since_current_year --credentials=${{ secrets.DATA_UPDATE_CREDENTIALS }} | |
# Refresh the team information in case it has changed. Also update the team data. | |
load_team_data: | |
name: Load Team Data | |
needs: [set_up_environment, load_blue_banners] | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./util | |
steps: | |
- name: Check out default branch | |
uses: actions/checkout@v4 | |
# Load the cached poetry install from the environment set up step. | |
- name: cache poetry install | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
key: poetry-1.5.1 | |
# Install dependencies. `--no-root` means "install all dependencies but not the project | |
# itself", which is what you want to avoid caching _your_ code. The `if` statement | |
# ensures this only runs on a cache miss. | |
- run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
- name: Update team data | |
run: poetry run python main.py team --team_mode=full --credentials=${{ secrets.DATA_UPDATE_CREDENTIALS }} |