Use retrying Octokit to for GraphQL sync (#47656)
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
import dotenv from 'dotenv'
|
||||
import { Octokit } from '@octokit/rest'
|
||||
import { retry } from '@octokit/plugin-retry'
|
||||
|
||||
if (!process.env.GITHUB_TOKEN) {
|
||||
dotenv.config()
|
||||
}
|
||||
|
||||
const RetryingOctokit = Octokit.plugin(retry)
|
||||
|
||||
// this module needs to work in development, production, and GitHub Actions
|
||||
//
|
||||
// GITHUB_TOKEN comes from one of the following sources:
|
||||
@@ -20,3 +23,9 @@ export default function github() {
|
||||
auth: `token ${apiToken}`,
|
||||
})
|
||||
}
|
||||
|
||||
export function retryingGithub() {
|
||||
return new RetryingOctokit({
|
||||
auth: `token ${apiToken}`,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user