- commit
- 901900d
- parent
- 2474f3a
- author
- Eric Bower
- date
- 2022-06-18 16:40:13 +0000 UTC
be more resiliant with scaping and change gh action interval to 6 hours
2 files changed,
+16,
-4
+2,
-2
1@@ -1,11 +1,11 @@
2-name: "Fetch resources and deploy every 2 hours"
3+name: "Fetch resources and deploy on interval"
4
5 #on:
6 # push:
7 # branches: [main]
8 on:
9 schedule:
10- - cron: "0 */2 * * *"
11+ - cron: "0 */6 * * *"
12
13 env:
14 GITHUB_ACCESS_TOKEN: ${{secrets.ACCESS_TOKEN}}
+14,
-2
1@@ -73,7 +73,19 @@ async function githubApi(endpoint: string): Promise<Resp<{ [key: string]: any }>
2 await delay(wait);
3 }
4
5- const data = await res.json();
6+ let data = null;
7+ try {
8+ data = await res.json();
9+ } catch {
10+ return {
11+ ok: false,
12+ data: {
13+ status: res.status,
14+ error: new Error(`JSON parsing error [${url}]`)
15+ }
16+ }
17+ }
18+
19 if (res.ok) {
20 return {
21 ok: true,
22@@ -85,7 +97,7 @@ async function githubApi(endpoint: string): Promise<Resp<{ [key: string]: any }>
23 ok: false,
24 data: {
25 status: res.status,
26- error: new Error(`Could not load ${url}`),
27+ error: new Error(`Could not load [${url}]`),
28 },
29 };
30 }