diff --git a/package-lock.json b/package-lock.json index 4a2e61d..effda90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@actions/github": "^6.0.0", "@actions/http-client": "^2.2.3", "@actions/tool-cache": "^2.0.2", + "@octokit/plugin-retry": "^6.1.0", "@types/node": "^22.13.10", "@types/semver": "^7.5.8", "@types/tmp": "^0.2.6", @@ -570,6 +571,23 @@ "@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": { "version": "8.4.1", "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", "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": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", diff --git a/package.json b/package.json index c0b1f3b..d68936a 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", "@actions/http-client": "^2.2.3", + "@octokit/plugin-retry": "^6.1.0", "@actions/tool-cache": "^2.0.2", "@types/node": "^22.13.10", "@types/semver": "^7.5.8", diff --git a/src/patch.ts b/src/patch.ts index aed412b..f2bb412 100644 --- a/src/patch.ts +++ b/src/patch.ts @@ -1,6 +1,7 @@ import * as core from "@actions/core" import * as github from "@actions/github" import { Context } from "@actions/github/lib/context" +import * as pluginRetry from "@octokit/plugin-retry" import fs from "fs" import path from "path" import { dir } from "tmp" @@ -43,7 +44,7 @@ async function fetchPullRequestPatch(ctx: Context): Promise { 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 try { @@ -81,7 +82,7 @@ async function fetchPullRequestPatch(ctx: Context): Promise { } async function fetchPushPatch(ctx: Context): Promise { - 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 try {