Weather Forecast CRON #475
This file contains 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: Weather Forecast CRON | |
# Runs every morning at 08:30 (UTC+1 time) | |
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 maybe save JSON | |
run: python forecast_weather.py | |
- name: Configure Git | |
run: | | |
git config --global user.name "Weather Forecast Bot" | |
git config --global user.email "<>" | |
- name: Commit and push changes to main branch | |
run: | | |
git add . | |
git commit -m "Today's weather forecast" | |
git push origin main |