Skip to content

Commit

Permalink
Try fetching calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Apr 18, 2024
1 parent 0395e83 commit 921e937
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/getcalendar.yml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 7 additions & 0 deletions calendar.sh
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit 921e937

Please sign in to comment.