Locum Agent Daily #138
This file contains hidden or 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: Locum Agent Daily | |
| on: | |
| schedule: | |
| - cron: "0 14 * * 1-5" # 08:00 AM MT (Mon–Fri) | |
| - cron: "30 21 * * 1-5" # 03:30 PM MT (Mon–Fri) | |
| - cron: "0 8 * * *" # 02:00 AM MT daily data refresh | |
| workflow_dispatch: | |
| jobs: | |
| run-daily: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Train & Score | |
| env: | |
| RED_THRESHOLD: "0.70" | |
| run: | | |
| python app/scripts/train_predictor.py | |
| - name: Debug secrets (safe) | |
| # This step prints a safe indicator: the length of the API key and the MAIL_FROM value. | |
| # It does NOT print the API key itself. Useful for diagnosing missing/empty secrets in Actions. | |
| env: | |
| SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }} | |
| MAIL_FROM: ${{ secrets.MAIL_FROM }} | |
| run: | | |
| echo "KEY_LEN=${#SENDGRID_API_KEY:-0} MAIL_FROM=${MAIL_FROM:-<not set>}" | |
| - name: Send Digest (SendGrid) | |
| env: | |
| SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }} | |
| MAIL_FROM: ${{ secrets.MAIL_FROM }} | |
| DIGEST_TOP_N: "20" | |
| run: | | |
| if [ -z "${SENDGRID_API_KEY:-}" ] || [ -z "${MAIL_FROM:-}" ]; then | |
| echo "Skipping Send Digest: SENDGRID_API_KEY or MAIL_FROM secret is not set." | |
| echo "To enable: add repository secrets 'SENDGRID_API_KEY' and 'MAIL_FROM'." | |
| exit 0 | |
| fi | |
| python app/scripts/send_digest_sendgrid.py |