forked from octoherd/octokit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (25 loc) · 849 Bytes
/
index.js
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
import { Octokit as OctokitCore } from "@octokit/core";
import { paginateRest } from "@octokit/plugin-paginate-rest";
import { throttling } from "@octokit/plugin-throttling";
import { retry } from "@octokit/plugin-retry";
import { logger } from "./octokit-plugins/logger.js";
import { VERSION } from "./version.js";
export { VERSION } from "./version.js";
export const Octokit = OctokitCore.plugin(
logger,
paginateRest,
throttling,
retry
).defaults({
userAgent: `octoherd-cli/${VERSION}`,
throttle: {
onSecondaryRateLimit: (error, options, octokit, retryCount) => {
octokit.log.error("onSecondaryRateLimit", error, options);
return retryCount < 3;
},
onRateLimit: (error, options, octokit, retryCount) => {
octokit.log.error("onRateLimit", error, options);
return retryCount < 3;
},
},
});