-
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (39 loc) · 1.21 KB
/
update-events.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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