Skip to content

Calendar Sync

Calendar Sync #15

Workflow file for this run

# Compares the ICS file with the latest changes in the repository and creates an issue if there are any discrepancies.
# If there are changes, it updates the ICS file and pushes the changes back to the repository.
name: Calendar Sync
on:
push:
branches:
- master
schedule:
- cron: "0 3 * * *" # Runs every day at 3AM
pull_request: # do not change this to pull_request_target!
workflow_dispatch:
permissions:
contents: write
issues: write
jobs:
sync-calendar:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r _calendar/requirements.txt
- name: Run script to compare ICS and create issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python _calendar/compare_ics_and_create_issue.py
- name: Check for changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if [ -n "$(git diff --exit-code hack_harder.ics)" ]; then
git add hack_harder.ics
git commit -m "Update hack_harder.ics based on latest changes"
git push
else
echo "No changes detected."
fi