Skip to content

Update calendar

Update calendar #3

Workflow file for this run

name: update-calendar
run-name: Update calendar
on:
workflow_dispatch:
schedule:
# Run every hour
- cron: "0 */1 * * *"
jobs:
fetch-calendar:
runs-on: ubuntu-latest
env:
DOC_ROOT: ${{ github.workspace }}/GIST
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download calendar from Nextcloud
run: curl 'https://files.x-hain.de/remote.php/dav/public-calendars/Yi63cicwgDnjaBHR/?export&accept=jcal' > temp.json
- name: Create data directory if it doesn't exist
run: mkdir -p data
- name: Convert CalDav format to useful JSON
uses: sergeysova/jq-action@v2
id: keywords
with:
cmd: 'jq ".[2][][1] | map({key:.[0], value:.[3]}) | from_entries" ./temp.json | jq -s > data/calendar.json'
multiline: true
- name: Test output
run: |
keywords="${{ steps.keywords.outputs.value }}"
for keyword in $keywords; do
echo "$keyword"
done
- name: Commit and push changes to facts file
run: |
git config user.email "robot@github.com"
git config user.name "${{ github.actor }}"
git add .
git commit -m "Update calander data file"
git push