Streamchaser #27
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: Streamchaser | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' | |
| workflow_dispatch: | |
| jobs: | |
| chase: | |
| name: Fetch - Chart - Post | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: write | |
| env: | |
| USGS_STATION_ID: "11284400" | |
| USGS_STATION_NAME: "Big Creek @ Whites Gulch" | |
| USGS_HASHTAGS: "#USGS #BigCreek #Groveland" | |
| POST_TWITTER: "true" | |
| POST_BLUESKY: "true" | |
| 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 }} | |
| GMAIL_USER: ${{ secrets.GMAIL_USER }} | |
| GMAIL_APP_PASSWORD: ${{ secrets.GMAIL_APP_PASSWORD }} | |
| SMS_ADDRESS: ${{ secrets.SMS_ADDRESS }} | |
| run: python -m streamchaser | |
| - name: Update charts in repo | |
| if: always() | |
| run: | | |
| mkdir -p chart | |
| # Big Creek | |
| [ -f /tmp/latest_11284400.png ] && cp /tmp/latest_11284400.png chart/big_creek.png | |
| # Tuolumne BL Early Intake | |
| [ -f /tmp/latest_11276900.png ] && cp /tmp/latest_11276900.png chart/tuolumne_early_intake.png | |
| # Cherry Creek | |
| [ -f /tmp/latest_11278300.png ] && cp /tmp/latest_11278300.png chart/cherry_creek.png | |
| # latest.png = Big Creek for README | |
| [ -f /tmp/latest_11284400.png ] && cp /tmp/latest_11284400.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 |