-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (53 loc) · 1.85 KB
/
interval-crawler-task.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
name: Interval Crawler Task
on:
schedule:
- cron: '35 8 * 7-9,12 *'
- cron: '35 * * 1-6,10-11 *'
workflow_dispatch:
jobs:
crawl-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PAT }}
- name: Pull the latest data branch
run: |
git config user.name ZKLlab-bot
git config user.email zkllab-bot@mail.zkllab.com
git subtree add --prefix=interval-crawler-task-result origin data
- name: Duplicate data folder
run: |
cp -r interval-crawler-task-result data
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install OpenVPN Client
run: |
sudo apt-get update && sudo apt-get -y install openvpn
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install
- name: Connect to OpenVPN
run: |
echo "${{ secrets.SHU_USERNAME }}" > /tmp/ovpn-auth.txt
echo "${{ secrets.SHU_PASSWORD }}" >> /tmp/ovpn-auth.txt
sudo openvpn --config ./shu-student.ovpn --auth-user-pass /tmp/ovpn-auth.txt --daemon
- name: Wait for OpenVPN connection
timeout-minutes: 2
run: |
until ping -c1 xk.autoisp.shu.edu.cn; do sleep 2; done
- name: Fetch data
run: |
echo "${{ secrets.SHU_PASSWORD }}" | pipenv run python crawler.py -o interval-crawler-task-result -u ${{ secrets.SHU_USERNAME }} --password-stdin
- name: Shutdown OpenVPN
run: |
sudo killall openvpn
- name: Compare, push, and create a pull request if necessary
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
pipenv run python post_crawler.py