-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (63 loc) · 2.53 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Timetable scrape
# Controls when the workflow will run
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 */8 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
scrape:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Retrieve the private key and decode it to a file
env:
PRIVATE_KEY_BASE64: ${{ secrets.PRIVATE_KEY_BASE64 }}
run: |
echo $PRIVATE_KEY_BASE64 | base64 --decode > keys/private_key.asc
- name: Import private key
env:
PRIVATE_KEY_BASE64: ${{ secrets.PRIVATE_KEY_BASE64 }}
run: |
gpg --import keys/private_key.asc
- name: Decode teachers.txt.gpg
env:
PRIVATE_KEY_BASE64: ${{ secrets.PRIVATE_KEY_BASE64 }}
run: |
gpg --output config/teachers.txt --decrypt config/teachers.txt.gpg
- name: Decode hardcoded_abbreviations.txt.gpg
env:
PRIVATE_KEY_BASE64: ${{ secrets.PRIVATE_KEY_BASE64 }}
run: |
gpg --output config/hardcoded_abbreviations.txt --decrypt config/hardcoded_abbreviations.txt.gpg
- name: Configure git
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Update packages
run: sudo apt-get update
- name: Install poppler-utils
run: sudo apt-get install poppler-utils
- name: Run the scraper
working-directory: ./src
run: "./scraper.sh ${{ github.event_name }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
- name: Check file existence
id: check_file
uses: andstor/file-existence-action@v1
with:
files: "src/bgschoolbot-need-update"
- name: Update BgSchoolBot database
if: steps.check_file.outputs.files_exists == 'true'
uses: wei/curl@master
with:
args: "https://bgschool.cristianlivella.com/gh-actions/update.php?token=${{ secrets.BGSCHOOLBOT_TOKEN }}"