Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 94fc36e

Browse files
authored
add retry plugin (#195)
1 parent d9cbf24 commit 94fc36e

File tree

4 files changed

+123
-4
lines changed

4 files changed

+123
-4
lines changed

dist/index.js

Lines changed: 99 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@actions/github": "^5.1.1",
3030
"@dqbd/tiktoken": "^1.0.6",
3131
"@octokit/action": "^5.0.2",
32+
"@octokit/plugin-retry": "^4.1.3",
3233
"@octokit/plugin-throttling": "^5.0.1",
3334
"minimatch": "^9.0.0",
3435
"node-fetch": "^3.3.1",

src/octokit.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as core from '@actions/core'
22
import {Octokit} from '@octokit/action'
3+
import {retry} from '@octokit/plugin-retry'
34
import {throttling} from '@octokit/plugin-throttling'
45

56
const token = core.getInput('token') || process.env.GITHUB_TOKEN
67

7-
const ThrottlingOctokit = Octokit.plugin(throttling)
8-
export const octokit = new ThrottlingOctokit({
8+
const RetryAndThrottlingOctokit = Octokit.plugin(throttling, retry)
9+
export const octokit = new RetryAndThrottlingOctokit({
910
auth: `token ${token}`,
1011
throttle: {
1112
onRateLimit: (
@@ -28,5 +29,9 @@ Retry count: ${retryCount}
2829
)
2930
return true
3031
}
32+
},
33+
retry: {
34+
doNotRetry: ['429'],
35+
maxRetries: 10
3136
}
3237
})

0 commit comments

Comments
 (0)