-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (71 loc) · 2.24 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Interval Crawler Task
on:
schedule:
- cron: '35 8 * 7-9,12 *'
- cron: '35 * * 1-6,10-11 *'
pull_request:
branches: ['main']
workflow_dispatch:
concurrency:
group: interval-crawler
cancel-in-progress: true
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 [email protected]
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: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Fetch data
env:
SHUSTUID: ${{ secrets.SHU_USERNAME }}
SHUSTUPWD: ${{ secrets.SHU_PASSWORD }}
OUTPUTDIR: interval-crawler-task-result
run: yarn start
- name: Check Results
run: |
tree -I node_modules
- 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