Skip to content

Streamchaser

Streamchaser #1516

Workflow file for this run

name: Streamchaser
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
chase:
name: Fetch - Chart - Post
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
env:
CHART_OUTPUT_DIR: "/tmp"
PYTHONPATH: "src"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install matplotlib numpy requests Pillow tweepy atproto
- name: Run Streamchaser
env:
TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }}
TWITTER_API_SECRET: ${{ secrets.TWITTER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET }}
BLUESKY_HANDLE: ${{ secrets.BLUESKY_HANDLE }}
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}
run: python -m streamchaser
- name: Update charts in repo
if: always()
run: |
mkdir -p chart
# Copy latest chart for each station by picking the newest matching file
copy_latest() {
local sid=$1
local dest=$2
local f=$(ls -t /tmp/streamchaser_${sid}_*.png 2>/dev/null | head -1)
[ -n "$f" ] && cp "$f" "chart/${dest}.png"
}
# Tuolumne chain
copy_latest 11276500 hetch_hetchy
copy_latest 11274790 tuolumne_grand_canyon
copy_latest 11276900 tuolumne_early_intake
copy_latest 11289650 tuolumne_lagrange
copy_latest 11290000 tuolumne_modesto
# Merced
copy_latest 11264500 merced_happy_isles
copy_latest 11266500 merced_pohono
# Stanislaus
copy_latest 11303000 stanislaus_ripon
# Local tributaries
copy_latest 11284400 big_creek
copy_latest 11278300 cherry_creek
# latest.png = Big Creek for README default
[ -f chart/big_creek.png ] && cp chart/big_creek.png chart/latest.png
git config user.name "streamchaser-bot"
git config user.email "bot@streamchaser"
git add chart/
git diff --staged --quiet || git commit -m "chore: update charts [skip ci]"
git push
- name: Save chart artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: charts-${{ github.run_number }}
path: /tmp/streamchaser_*.png
retention-days: 5