Skip to content

Weather Forecast CRON #572

Weather Forecast CRON

Weather Forecast CRON #572

name: Weather Forecast CRON
# Runs every morning at 09:30 CEST time (CET+1)
on:
workflow_dispatch:
schedule:
- cron: "30 07 * * *"
jobs:
forecast_weather:
runs-on: ubuntu-latest
env:
WEATHER_FORECAST_API_URL: ${{ secrets.WEATHER_FORECAST_API_URL }}
USER_AGENT: ${{ secrets.USER_AGENT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Output Current Time
run: |
echo "Current time: $(date +'%Y-%m-%d %H:%M:%S')"
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Call API and save JSON
run: python api.py
- name: Configure Git
run: |
git config --global user.name "Weather Forecast Bot"
git config --global user.email "<>"
- name: Push Generated PNG Image
run: |
git add assets/forecast.png
git commit -m "Overwrote image of today's weather forecast plot"
git push origin main