-
Notifications
You must be signed in to change notification settings - Fork 21
43 lines (37 loc) · 1.21 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
name: >
[MANUAL] Scrape Term
on:
workflow_dispatch:
inputs:
term:
required: true
description: Term to scrape (e.g. sp2021)
source:
required: false
default: sis.nyu.edu
description: Source to scrape from (either schedge-v1 or sis.nyu.edu)
jobs:
scrape:
name: "Scrape ${{ github.event.inputs.term }} from ${{ github.event.inputs.source }}"
runs-on: ubuntu-latest
environment: admin
permissions:
contents: read
steps:
- name: Install Websocat
run: wget https://github.com/vi/websocat/releases/download/v1.11.0/websocat.x86_64-unknown-linux-musl -O ./websocat
- name: Update Permissions
run: chmod +x ./websocat
- name: Run Scrape on ${{ github.event.inputs.term }}
run: >
exec ./websocat
"wss://nyu.a1liu.com/api/scrape/${{ github.event.inputs.term }}?source=${{ github.event.inputs.source }}"
-n --basic-auth "${{ secrets.SCHEDGE_PASSWORD }}"
| tee output.txt
- name: Check for success
run: |
output=$(tail output.txt)
if [[ "$output" =~ "Failed: ".* ]]; then
echo "Scraping failed"
exit 1
fi