events update #695
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: events update | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 2 * * * | |
jobs: | |
update-events: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y python3 python3-pip python3-setuptools wget | |
sudo pip3 install -r scripts/requirements.txt | |
- name: Validate Feeds | |
run: python3 scripts/check_feeds.py | |
- name: Update Events | |
run: python3 scripts/update_events.py ./calendars | |
# TODO automation to post updates | |
- name: Push Updates | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
printf "GitHub Actor: ${GITHUB_ACTOR}\n" | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add calendars/*.ical | |
set +e | |
git status | grep modified | |
if [ $? -eq 0 ]; then | |
set -e | |
printf "Changes\n" | |
git commit -m "Automated push to update events $(date '+%Y-%m-%d')" || exit 0 | |
git push origin main | |
else | |
set -e | |
printf "No changes\n" | |
fi |