-
Notifications
You must be signed in to change notification settings - Fork 6
58 lines (50 loc) · 1.77 KB
/
course-seat-tracker.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
name: Notify if a seat is available in a course
# Triggers for the GitHub Action workflow
on:
# Trigger the workflow on pushes to the main branch
push:
branches:
- main
- "ecc-cs8"
# Schedule the workflow to run every 5 minutes
schedule:
- cron: '*/5 * * * *'
# Allow manual triggering of the workflow
workflow_dispatch:
jobs:
# Define the job for checking course seat availability
course-seat-tracker:
# Specify the type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checkout the repository to access the code
- name: Checkout code
uses: actions/checkout@v3
# Setup the Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
# Cache the installed Python packages to speed up the workflow
- name: Cache Python packages
uses: actions/cache@v3
with:
path: |
~/.cache/pip
# Use the OS and requirements.txt file's hash to create a unique cache key
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# Fallback cache keys to restore cache in case of a cache miss
restore-keys: |
${{ runner.os }}-pip-
# Install Python dependencies from requirements.txt
- name: Install dependencies
run: pip install -r requirements.txt
# Run the script to check for seat availability
- name: Check seat availability
run: python main.py
id: check-seat
# Note that if sucess, then it should be no seat available!
# It only notifies when the Action fails.
- name: No Email for No Seat Availability
if: success()
run: echo "No seat is available."