-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (28 loc) · 899 Bytes
/
scrape.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Scrape data
on:
push:
workflow_dispatch:
schedule:
- cron: '9 * * * *' #1700 SGT
jobs:
scheduled:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Check out this repo
uses: actions/checkout@v2
- name: Fetch latest data
run: |-
today=$(date +"%Y-%m-%d")
curl -X GET "https://api.data.gov.sg/v1/environment/air-temperature?date=$today" -H "accept: application/json" | jq . > weather.json
- name: Commit and push if it changed
run: |-
git config user.name "Github Actions"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}" || exit 0
git push