Skip to content

Add GitHub Actions workflow #1

Add GitHub Actions workflow

Add GitHub Actions workflow #1

Workflow file for this run

name: Generate courses
on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '0 8 * * *'
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
path: main
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Generate courses
run: |
python -u ./main/courses_to_json.py last-3 './gh-pages/courses_{year}_{semester}.json'
- name: Deploy
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git diff-index --quiet --cached HEAD || git commit -m "Update courses"
git push