Skip to content

Fetch weather and Commit #29485

Fetch weather and Commit

Fetch weather and Commit #29485

Workflow file for this run

name: Fetch weather and Commit
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *'
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Check out this repo
uses: actions/checkout@v2
- name: Fetch weather from openweathermap
env:
OPENWEATHERMAP_KEY: ${{ secrets.OPENWEATHERMAP_KEY }}
run: |-
curl "https://api.openweathermap.org/data/2.5/onecall?lat=-33.87&lon=18.66&appid=$OPENWEATHERMAP_KEY&units=metric" | jq . > ./forecast.json
- name: Commit and push if it changed
run: |-
git config user.name "Automated"
git config user.email "actions@users.noreply.github.com"
git add -A
timestamp=$(date -u +%F" "%T" UTC")
git commit -m "Latest weather forecast: ${timestamp}" || exit 0
git push