Refresh live environment #748
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: Refresh live environment | |
| on: | |
| schedule: | |
| # Hourly, at :17 past the hour (UTC). Buoys report ~hourly; offset avoids | |
| # the top-of-hour cron rush. | |
| - cron: "17 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: live-environment | |
| cancel-in-progress: true | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Fetch latest environmental observations | |
| run: python3 scripts/build_live_temperature.py | |
| - name: Commit snapshot if changed | |
| run: | | |
| if git diff --quiet -- src/data/liveTemperature.json; then | |
| echo "No change in liveTemperature.json" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add src/data/liveTemperature.json | |
| git commit -m "Refresh live environmental snapshot" | |
| git push |