fix: octokit retry (#1193)

This commit is contained in:
Ludovic Fernandez 2025-03-12 17:09:01 +01:00 committed by GitHub
parent b871b4f9de
commit 7e7b516e44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 3338 additions and 6 deletions

1657
dist/post_run/index.js generated vendored

File diff suppressed because it is too large Load Diff

1657
dist/run/index.js generated vendored

File diff suppressed because it is too large Load Diff

24
package-lock.json generated
View File

@ -15,6 +15,7 @@
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@actions/http-client": "^2.2.3", "@actions/http-client": "^2.2.3",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"@octokit/plugin-retry": "^6.1.0",
"@types/node": "^22.13.10", "@types/node": "^22.13.10",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@types/tmp": "^0.2.6", "@types/tmp": "^0.2.6",
@ -570,6 +571,23 @@
"@octokit/openapi-types": "^20.0.0" "@octokit/openapi-types": "^20.0.0"
} }
}, },
"node_modules/@octokit/plugin-retry": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.1.0.tgz",
"integrity": "sha512-WrO3bvq4E1Xh1r2mT9w6SDFg01gFmP81nIG77+p/MqW1JeXXgL++6umim3t6x0Zj5pZm3rXAN+0HEjmmdhIRig==",
"license": "MIT",
"dependencies": {
"@octokit/request-error": "^5.0.0",
"@octokit/types": "^13.0.0",
"bottleneck": "^2.15.3"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/request": { "node_modules/@octokit/request": {
"version": "8.4.1", "version": "8.4.1",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz",
@ -1239,6 +1257,12 @@
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
}, },
"node_modules/bottleneck": {
"version": "2.19.5",
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==",
"license": "MIT"
},
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

View File

@ -29,6 +29,7 @@
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@actions/http-client": "^2.2.3", "@actions/http-client": "^2.2.3",
"@octokit/plugin-retry": "^6.1.0",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"@types/node": "^22.13.10", "@types/node": "^22.13.10",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",

View File

@ -1,6 +1,7 @@
import * as core from "@actions/core" import * as core from "@actions/core"
import * as github from "@actions/github" import * as github from "@actions/github"
import { Context } from "@actions/github/lib/context" import { Context } from "@actions/github/lib/context"
import * as pluginRetry from "@octokit/plugin-retry"
import fs from "fs" import fs from "fs"
import path from "path" import path from "path"
import { dir } from "tmp" import { dir } from "tmp"
@ -43,7 +44,7 @@ async function fetchPullRequestPatch(ctx: Context): Promise<string> {
return `` return ``
} }
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true })) const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }), {}, pluginRetry.retry)
let patch: string let patch: string
try { try {
@ -81,7 +82,7 @@ async function fetchPullRequestPatch(ctx: Context): Promise<string> {
} }
async function fetchPushPatch(ctx: Context): Promise<string> { async function fetchPushPatch(ctx: Context): Promise<string> {
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true })) const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }), {}, pluginRetry.retry)
let patch: string let patch: string
try { try {