Trigger Regybox #124
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: Trigger Regibox | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
schedule: # 60 hours in advance for morning classes | |
- cron: 15 18 * * 5-6,0-2 | |
jobs: | |
build: | |
name: Trigger Regibox run | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Set up pants | |
uses: pantsbuild/actions/init-pants@v5-scie-pants | |
with: | |
gha-cache-key: v0 | |
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: Regibox enroll | |
run: pants run regibox:main -- ${{ env.CLASS_DATE }} ${{ env.CLASS_TIME }} ${{ env.CLASS_TYPE }} | |
env: | |
PHPSESSID: ${{ secrets.PHPSESSID }} | |
REGIBOX_USER: ${{ secrets.REGIBOX_USER }} | |
- name: Send mail | |
if: always() | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: smtp.gmail.com | |
server_port: 465 | |
username: ${{ secrets.EMAIL_USERNAME }} | |
password: ${{ secrets.EMAIL_PASSWORD }} | |
subject: > | |
Regibox 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: [email protected] | |
from: Regibox Auto-enroll |