-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.9 KB
/
Copy pathrun.yaml
File metadata and controls
51 lines (42 loc) · 1.9 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Daily CURL Request
on:
workflow_dispatch:
schedule:
# Runs at 0:55 AM AEST (UTC+10:00) every day.
- cron: '55 14 * * *'
jobs:
curl_request:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Calculate epoch values for today and tomorrow
id: date-calculation
run: |
# Calculate 'dateFrom' for today at the start of the day (00:00:00)
DATE_FROM=$(date -u +"%s" -d "today 00:00:00")
# Multiply by 1000 to convert seconds to milliseconds
DATE_FROM_MS=$((DATE_FROM * 1000))
# Calculate 'dateTo' for tomorrow at the start of the day (00:00:00)
DATE_TO=$(date -u +"%s" -d "tomorrow 00:00:00")
# Multiply by 1000 to convert seconds to milliseconds
DATE_TO_MS=$((DATE_TO * 1000))
# Write to the GITHUB_ENV
echo "DATE_FROM_MS=$DATE_FROM_MS" >> $GITHUB_ENV
echo "DATE_TO_MS=$DATE_TO_MS" >> $GITHUB_ENV
- name: CURL request to Queensland Events API
run: |
curl --compressed -X GET \
-H "Accept: application/json" \
"https://api.prod.aws.queensland.com/search?category=events&countryCode=au_en&dateFrom=${{ env.DATE_FROM_MS }}&dateTo=${{ env.DATE_TO_MS }}&destination=all-queensland&disabledClassificationsFilter=true&rawCategory=event" > events.json
- name: Commit events file
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git fetch --unshallow || true
git add events.json
count=$(jq '.hits.total.value' events.json)
summary=$(jq -r '.hits.hits[] | ._source.productName' events.json | sed 's/^/- /')
dt=$(date -u +'%Y-%m-%d')
git commit -m "${dt} : ${count} events" -m "${summary}" || exit 0
git push