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

Commit

Permalink
add retry plugin (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
harjotgill authored Apr 18, 2023
1 parent d9cbf24 commit 94fc36e
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 4 deletions.
101 changes: 99 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@actions/github": "^5.1.1",
"@dqbd/tiktoken": "^1.0.6",
"@octokit/action": "^5.0.2",
"@octokit/plugin-retry": "^4.1.3",
"@octokit/plugin-throttling": "^5.0.1",
"minimatch": "^9.0.0",
"node-fetch": "^3.3.1",
Expand Down
9 changes: 7 additions & 2 deletions src/octokit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as core from '@actions/core'
import {Octokit} from '@octokit/action'
import {retry} from '@octokit/plugin-retry'
import {throttling} from '@octokit/plugin-throttling'

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

const ThrottlingOctokit = Octokit.plugin(throttling)
export const octokit = new ThrottlingOctokit({
const RetryAndThrottlingOctokit = Octokit.plugin(throttling, retry)
export const octokit = new RetryAndThrottlingOctokit({
auth: `token ${token}`,
throttle: {
onRateLimit: (
Expand All @@ -28,5 +29,9 @@ Retry count: ${retryCount}
)
return true
}
},
retry: {
doNotRetry: ['429'],
maxRetries: 10
}
})

0 comments on commit 94fc36e

Please sign in to comment.