40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
name: Weather Alerts
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 * * * *' # Every hour at :00
|
|
workflow_dispatch: {} # Manual trigger
|
|
|
|
jobs:
|
|
check-weather:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: python:3.11-slim
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Install Node.js (required for actions)
|
|
run: |
|
|
apt-get update && apt-get install -y nodejs git
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements.txt
|
|
|
|
- name: Run weather alerts
|
|
env:
|
|
VISUALCROSSING_API_KEY: ${{ secrets.VISUALCROSSING_API_KEY }}
|
|
NTFY_ACCESS_TOKEN: ${{ secrets.NTFY_ACCESS_TOKEN }}
|
|
run: python -m app.main
|
|
|
|
- name: Commit state changes
|
|
run: |
|
|
git config --global user.name "Gitea Actions"
|
|
git config --global user.email "actions@gitea.local"
|
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
git add data/state.json
|
|
git diff --staged --quiet || git commit -m "chore: update weather alert state [skip ci]"
|
|
git push
|