Skip to content

Commit

Permalink
only use node-fetch when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Sep 18, 2023
1 parent b297d96 commit c83e728
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion incubator/build/src/remotes/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const workflowRunCache: Record<string, number> = {};

const octokit = once(() => {
const RestClient = Octokit.plugin(restEndpointMethods);
return new RestClient({ auth: getPersonalAccessToken(), request: { fetch } });
return new RestClient({
auth: getPersonalAccessToken(),
// Use `node-fetch` only if Node doesn't have it:
// https://github.com/octokit/request.js/blob/v8.1.1/src/fetch-wrapper.ts#L28-L31
request: "fetch" in globalThis ? undefined : { fetch },
});
});

async function downloadArtifact(
Expand Down

0 comments on commit c83e728

Please sign in to comment.