Skip to content

Commit

Permalink
refactor: use got with retries instead of @octokit/request to ret…
Browse files Browse the repository at this point in the history
…rieve the docs HTML pages (#597)

this will hopefully work around build errors such as
https://github.com/octokit/webhooks/runs/4486395928\?check_suite_focus\=true\#step:7:39
  • Loading branch information
gr2m committed Dec 10, 2021
1 parent 378a8f3 commit ce6ab8f
Show file tree
Hide file tree
Showing 3 changed files with 8,094 additions and 34 deletions.
9 changes: 7 additions & 2 deletions lib/get-html.ts
@@ -1,4 +1,4 @@
import { request } from "@octokit/request";
import got from "got";
import cheerio from "cheerio";
import prettier from "prettier";
import { State, cache } from ".";
Expand All @@ -19,7 +19,12 @@ export const getHtml = async (

console.log(`⌛ fetching ${WEBHOOKS_DOCS_URL}`);

const { data: body } = (await request(WEBHOOKS_DOCS_URL)) as { data: string };
const { body } = await got(WEBHOOKS_DOCS_URL, {
retry: {
limit: 10,
statusCodes: [503],
},
});
const $ = cheerio.load(body);

// get only the HTML we care about to avoid unnecessary cache updates
Expand Down

0 comments on commit ce6ab8f

Please sign in to comment.