Skip to content

Trigger Regybox

Trigger Regybox #414

---
name: Trigger Regybox
on: # yamllint disable-line rule:truthy
workflow_dispatch:
schedule: # 60 hours in advance for morning classes
# standard time, will be off on the last week of march
- cron: 15 18 * 1-3,11-12 5-6,0-2
# daylight saving time, will be off on the last week of october
- cron: 15 17 * 4-10 5-6,0-2
jobs:
build:
name: Trigger Regybox run
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up pants
uses: pantsbuild/actions/init-pants@v9
with:
gha-cache-key: ${{ runner.os }}-pants-init-${{ hashFiles('pants.toml') }}
named-caches-hash: ${{ hashFiles('3rdparty/python/default.lock') }}
- name: Get class date
run: |
echo "CLASS_DATE=$(date -d '+3 days' +%F)" >> $GITHUB_ENV
echo "CLASS_TIME='06:30'" >> $GITHUB_ENV
echo "CLASS_TYPE='WOD Rato'" >> $GITHUB_ENV
- name: Regybox enroll
run: pants run regybox:main -- ${{ env.CLASS_DATE }} ${{ env.CLASS_TIME }} ${{ env.CLASS_TYPE }}
env:
PHPSESSID: ${{ secrets.PHPSESSID }}
REGYBOX_USER: ${{ secrets.REGYBOX_USER }}
CALENDAR_URL: ${{ secrets.CALENDAR_URL }}
- name: Send mail
if: always()
uses: dawidd6/action-send-mail@v4
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: >
Regybox Auto-enroll: ${{ job.status }} for ${{ env.CLASS_TYPE }} on ${{ env.CLASS_DATE }}
at ${{ env.CLASS_TIME }}
body: >
Job '${{ github.job }}' in worflow ${{ github.workflow }} of ${{ github.repository }} finished in a
${{ job.status }} state.
See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
to: ${{ secrets.EMAIL_TO }}
from: Regybox Auto-enroll