Shambhala schedule updates #201
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
# This workflow fetches new Shambhala schedule data and commit and changes back to the repo | |
name: Shambhala schedule updates | |
env: | |
FESTIVAL_YEAR: 2024 | |
FESTIVAL_DATA_PATH: festivals/shambhalafestival | |
on: | |
# This only runs on default branch | |
schedule: | |
- cron: "12 */6 * 6 *" # At minute 12 past every 6th hour in June. | |
- cron: "12 */6 1-23 7 *" # At minute 12 past every 6th hour on every day-of-month from 1 through 23 in July. | |
push: | |
branches: | |
- "main" | |
- "gh-automation" ## For testing/development | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Write secrets to .env file | |
run: | | |
cat << EOF > ${FESTIVAL_DATA_PATH}/.env | |
SESSION_KEY=${{ secrets.SHAMBHALA_SESSION_KEY }} | |
EOF | |
- name: Fetch latest schedule data from API | |
run: | | |
pushd ${FESTIVAL_DATA_PATH} | |
./${FESTIVAL_YEAR}.sh | |
popd | |
- name: Transform data into clashfinder text format | |
run: | | |
source .venv/bin/activate | |
./bin/appmiral_transform.py --tz "US/Pacific" --artists ${FESTIVAL_DATA_PATH}/${FESTIVAL_YEAR}/shambhalafestival.artists.json --stages ${FESTIVAL_DATA_PATH}/${FESTIVAL_YEAR}/shambhalafestival.stages.json > ${FESTIVAL_DATA_PATH}/${FESTIVAL_YEAR}/clashfinder.txt | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Automated Shambhala festival data update | |
file_pattern: '*.json *.txt' | |