Skip to content

Odds Pipeline Cron #967

Odds Pipeline Cron

Odds Pipeline Cron #967

Workflow file for this run

name: Odds Pipeline Cron
on:
schedule:
# All times in UTC (ET = UTC-5 during EST, UTC-4 during EDT)
# Morning poll: 10 AM ET = 15:00 UTC (14:00 during EDT)
- cron: '0 14 * * *'
# Afternoon polls: Every hour 12 PM - 6 PM ET = 16:00-22:00 UTC
- cron: '0 16-22 * * *'
# Evening polls: Every 30 min 6 PM - 12 AM ET = 22:00-04:00 UTC
- cron: '0,30 22-23 * * *'
- cron: '0,30 0-4 * * *'
# Late night lock: 1:30 AM ET = 06:30 UTC
- cron: '30 6 * * *'
# Nightly cards: 11 PM ET = 04:00 UTC
- cron: '0 4 * * *'
workflow_dispatch:
inputs:
action:
description: 'Action to run'
required: true
default: 'poll'
type: choice
options:
- poll
- lock
- cards
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
ODDS_API_KEY: ${{ secrets.ODDS_API_KEY }}
SHARPSPORTS_API_KEY: ${{ secrets.SHARPSPORTS_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
jobs:
odds-pipeline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
pip install -e .
pip install psycopg2-binary requests
- name: NHL source-health gate
run: python scripts/health/source_health_nhl.py
- name: Determine action based on time
id: action
run: |
HOUR=$(TZ=America/New_York date +%H)
if [ "${{ github.event.inputs.action }}" != "" ]; then
echo "action=${{ github.event.inputs.action }}" >> $GITHUB_OUTPUT
elif [ "$HOUR" = "01" ] && [ "$(date +%M)" -ge "30" ]; then
echo "action=lock" >> $GITHUB_OUTPUT
elif [ "$HOUR" = "23" ]; then
echo "action=cards" >> $GITHUB_OUTPUT
else
echo "action=poll" >> $GITHUB_OUTPUT
fi
- name: Poll odds
if: steps.action.outputs.action == 'poll'
run: python scripts/poll_odds.py --days 3
- name: Lock final results
if: steps.action.outputs.action == 'lock'
run: python scripts/poll_odds.py --lock
- name: Generate cards
if: steps.action.outputs.action == 'cards'
run: python scripts/poll_odds.py --cards