Skip to content

fetch-latest-powerball #61

fetch-latest-powerball

fetch-latest-powerball #61

Workflow file for this run

name: fetch-latest-powerball
on:
# push:
# branches:
# - main
schedule:
# Lottery schedule:
# ET: Monday, Wednesday, Saturday at 11:00 PM
# UTC: Tuesday, Thursday, Sunday at 4:00 AM (EST - winter) or 3:00 AM (EDT - summer)
# Cron schedule:
# ET: Tuesday, Thursday, Sunday at 1:00 AM, 7:00 AM (EST - winter) or 2:00 AM, 8:00 AM (EDT - summer)
# UTC: Tuesday, Thursday, Sunday at 6:00 AM, 12:00 PM
#
# Run twice in case of failure to better ensure the newest number gets picked up
# If it continues to fail re-run the historical data fetch and fix whatever the issue was
- cron: "0 6,12 * * 2,4,0"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install Python dependencies
run: |-
cd $GITHUB_WORKSPACE/scraper
pip install -r requirements.txt
# https://github.com/MarketingPipeline/Python-Selenium-Action/blob/main/.github/workflows/Selenium-Action_Template.yaml
- name: Installed OS package list
run: apt list --installed
- name: Removing previous chrome instances on runner
run: sudo apt purge google-chrome-stable
- name: Installing OS packages
run: pip install chromedriver-autoinstaller selenium
- name: Fetch latest Powerball numbers
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
run: |-
cd $GITHUB_WORKSPACE/scraper
python -m src.main powerball
cat $GITHUB_WORKSPACE/numbers/powerball.csv
- name: Commit Powerball data if changed
run: |-
git diff
git config --global user.email "actions@users.noreply.github.com"
git config --global user.name "JEFF-bot"
git add -A
git commit -m "Update Powerball data" || exit 0
git push