File tree 4 files changed +28
-6
lines changed
4 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 1
1
name : Get all URLs and begin crawling
2
2
3
3
on :
4
+ pull_request :
5
+ branches :
6
+ - main
4
7
push :
5
8
branches :
6
9
- main
12
15
runs-on : ubuntu-latest
13
16
steps :
14
17
- uses : actions/checkout@v3
18
+ - uses : actions/setup-node@v3
15
19
- name : Run script
16
- uses : tj-actions/puppeteer@v4
17
- id : puppeteer
18
- with :
19
- files : |
20
- .github/workflows/crawl.js
20
+ run : npm run crawl
21
21
env :
22
22
ALGOLIA_CRAWLER_API_KEY : ${{secrets.ALGOLIA_CRAWLER_API_KEY}}
23
23
ALGOLIA_CRAWLER_ID : ${{secrets.ALGOLIA_CRAWLER_ID}}
Original file line number Diff line number Diff line change
1
+ node_modules
2
+ package-lock.json
Original file line number Diff line number Diff line change 1
- const fetch = require ( 'node-fetch' ) ;
2
1
const puppeteer = require ( 'puppeteer' ) ;
3
2
4
3
( async ( ) => {
@@ -9,6 +8,11 @@ const puppeteer = require('puppeteer');
9
8
apiKey : process . env . ALGOLIA_CRAWLER_API_KEY ,
10
9
}
11
10
11
+ if ( ! crawler . url || ! crawler . id || ! crawler . userId || ! crawler . apiKey ) {
12
+ console . log ( "Missing required env vars" )
13
+ return
14
+ }
15
+
12
16
const updateUrls = async ( urls ) => {
13
17
const updateResponse = await fetch ( `${ crawler . url } /${ crawler . id } /config` , {
14
18
method : "PATCH" ,
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " api-schemas" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " This repository contains OpenAPI schemas for the Cloudflare API." ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "crawl" : " node crawl.js" ,
8
+ "test" : " echo \" Error: no test specified\" && exit 1"
9
+ },
10
+ "keywords" : [],
11
+ "author" : " " ,
12
+ "license" : " ISC" ,
13
+ "dependencies" : {
14
+ "puppeteer" : " ^19.9.0"
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments