-
Notifications
You must be signed in to change notification settings - Fork 33
51 lines (43 loc) · 1.28 KB
/
scrape.yml
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
51
name: Scrape Timetable
on:
#push:
workflow_run:
workflows: ["Semester Detection"]
types:
- completed
#schedule:
# - cron: "0 0 * * 0"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install pipenv
run: python -m pip install pipenv
- name: Install dependencies
working-directory: anuscrape
run: |
python -m pipenv install --system
- name: Run Scraper
working-directory: anuscrape
run: python3 ./scraper.py
- name: Compare new and old timetable
id: compare
continue-on-error: true
working-directory: anuscrape
run: diff ./timetable.json ../data/timetable.json
- name: Git commit and push
if: ${{ steps.compare.outcome == 'failure' }}
run: |
cd anuscrape
echo New update found at `date` >> ./updatelog.txt
mv -f ./timetable.json ../data/
python3 ./update_date.py
git config --global user.name 'Obi Symons'
git config --global user.email 'BishopOfTurkey@users.noreply.github.com'
git commit -am "Automatic Scrape"
git push