mirror of
https://github.com/actions/github-script.git
synced 2026-02-08 03:57:27 +00:00
Override the retryAfterBaseValue
This commit is contained in:
parent
e778eeb4a7
commit
2ca00a18c2
3 changed files with 19 additions and 4 deletions
13
.github/workflows/integration.yml
vendored
13
.github/workflows/integration.yml
vendored
|
|
@ -57,3 +57,16 @@ jobs:
|
||||||
if [[ "${{steps.output-set.outputs.result}}" != "@actions/core" ]]; then
|
if [[ "${{steps.output-set.outputs.result}}" != "@actions/core" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test-retry-after:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Test retry with after
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
retries: 3
|
||||||
|
retry-after: 999
|
||||||
|
script: |
|
||||||
|
console.log('Exec the plugin', context.repo.owner);
|
||||||
|
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,2 +1,4 @@
|
||||||
/node_modules/
|
/node_modules/
|
||||||
!/.vscode/
|
!/.vscode/
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
|
|
@ -5,7 +5,7 @@ import { RequestRequestOptions } from '@octokit/types'
|
||||||
export type RetryOptions = {
|
export type RetryOptions = {
|
||||||
doNotRetry?: number[]
|
doNotRetry?: number[]
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
delay?: number
|
retryAfterBaseValue?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRetryOptions(
|
export function getRetryOptions(
|
||||||
|
|
@ -23,7 +23,7 @@ export function getRetryOptions(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retryAfter > 0) {
|
if (retryAfter > 0) {
|
||||||
retryOptions.delay = retryAfter
|
retryOptions.retryAfterBaseValue = retryAfter
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exemptStatusCodes.length > 0) {
|
if (exemptStatusCodes.length > 0) {
|
||||||
|
|
@ -40,7 +40,7 @@ export function getRetryOptions(
|
||||||
|
|
||||||
core.debug(
|
core.debug(
|
||||||
`GitHub client configured with: (retries: ${requestOptions.retries
|
`GitHub client configured with: (retries: ${requestOptions.retries
|
||||||
}, retryAfter: ${retryOptions.delay ?? 'octokit default: 1000'
|
}, retryAfterBaseValue: ${retryOptions.retryAfterBaseValue ?? 'octokit default: 1000'
|
||||||
} retry-exempt-status-code: ${retryOptions?.doNotRetry ?? 'octokit default: [400, 401, 403, 404, 422]'
|
} retry-exempt-status-code: ${retryOptions?.doNotRetry ?? 'octokit default: [400, 401, 403, 404, 422]'
|
||||||
})`
|
})`
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue