This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch preview/calendar
in repository https://gitbox.apache.org/repos/asf/comdev-events-site.git
The following commit(s) were added to refs/heads/preview/calendar by this push:
new 921e937 Try fetching calendar
921e937 is described below
commit 921e937c09aa1a93348468ccba2e8c3f222cec87
Author: Sebb <[email protected]>
AuthorDate: Fri Apr 19 00:19:01 2024 +0100
Try fetching calendar
---
.github/workflows/getcalendar.yml | 34 ++++++++++++++++++++++++++++++++++
calendar.sh | 7 +++++++
2 files changed, 41 insertions(+)
diff --git a/.github/workflows/getcalendar.yml
b/.github/workflows/getcalendar.yml
new file mode 100644
index 0000000..514ac06
--- /dev/null
+++ b/.github/workflows/getcalendar.yml
@@ -0,0 +1,34 @@
+name: Fetch the Google Calendar
+
+on:
+ workflow_dispatch:
+ # schedule:
+ # - cron: '01 18 * * *'
+
+permissions:
+ contents: write
+
+jobs:
+ fetch-calendar:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Curl calendar
+ run: |
+ cd static/js
+ echo "download calendar"
+ bash ../../getcalendar.sh
+ echo "preparing to push change(s)"
+ git add .
+ if git commit -m "Add updates"
+ then
+ git push
+ echo "Changed!"
+ exit 0
+ else
+ echo "No change"
+ true # ensure success
+ fi
+ env: # for gh
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/calendar.sh b/calendar.sh
new file mode 100644
index 0000000..1c7c2c2
--- /dev/null
+++ b/calendar.sh
@@ -0,0 +1,7 @@
+CALENDAR_ID="[email protected]"
+API_KEY="AIzaSyDJkXq1faq2G5NkFkFTh9Sikdpc2YXTVXs"
+NOW=$(date '+%Y-%m-%dT%H:%M:%SZ')
+OPTS="?key=${API_KEY}&timeMin=${NOW}&singleEvents=true&orderBy=startTime&timezone=UTC&maxResults=20"
+curl -sS -o calendar.json
"https://www.googleapis.com/calendar/v3/calendars/${CALENDAR_ID}/events${OPTS}"
\
+ -H 'accept: application/json, text/javascript, */*; q=0.01' \
+ -H 'origin: https://events.apache.org'