1
0
mirror of synced 2026-01-02 03:04:13 -05:00

Use retrying Octokit to for GraphQL sync (#47656)

This commit is contained in:
Peter Bengtsson
2023-12-12 09:07:59 -05:00
committed by GitHub
parent a687a2fe03
commit d48ad66dcb
5 changed files with 36 additions and 19 deletions

View File

@@ -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}`,
})
}