-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (49 loc) · 1.43 KB
/
autofetch.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
name: autofetch
on:
workflow_dispatch:
schedule:
- cron: '0 0 * 12,1,2,3 2,3,4'
push:
paths:
- '.github/workflows/autofetch.yml'
- 'usaco_util.ts'
- 'add_problems.ts'
- 'update_ide.ts'
- 'run.sh'
- 'push.sh'
jobs:
scrape_usaco:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm i
- name: Add problems
run: npx ts-node --skipProject usaco_util.ts
- name: Push changes
run: source push.sh
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Update usacoProblems for IDE
run: npx ts-node update_ide
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Ping usaco-guide
uses: actions/github-script@v6
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: '${{ github.repository_owner }}',
repo: 'usaco-guide',
workflow_id: 'update-usaco.yml',
ref: 'master',
})