@@ -3340,6 +3340,18 @@ class CacheServiceClient {
33403340 }
33413341 errorMessage = `${errorMessage}: ${body.msg}`;
33423342 }
3343+ // Handle rate limiting - don't retry, just warn and exit
3344+ // For more info, see https://docs.github.com/en/actions/reference/limits
3345+ if (statusCode === http_client_1.HttpCodes.TooManyRequests) {
3346+ const retryAfterHeader = response.message.headers['retry-after'];
3347+ if (retryAfterHeader) {
3348+ const parsedSeconds = parseInt(retryAfterHeader, 10);
3349+ if (!isNaN(parsedSeconds) && parsedSeconds > 0) {
3350+ (0, core_1.warning)(`You've hit a rate limit, your rate limit will reset in ${parsedSeconds} seconds`);
3351+ }
3352+ }
3353+ throw new errors_1.RateLimitError(`Rate limited: ${errorMessage}`);
3354+ }
33433355 }
33443356 catch (error) {
33453357 if (error instanceof SyntaxError) {
@@ -3348,6 +3360,9 @@ class CacheServiceClient {
33483360 if (error instanceof errors_1.UsageError) {
33493361 throw error;
33503362 }
3363+ if (error instanceof errors_1.RateLimitError) {
3364+ throw error;
3365+ }
33513366 if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
33523367 throw new errors_1.NetworkError(error === null || error === void 0 ? void 0 : error.code);
33533368 }
@@ -3380,8 +3395,7 @@ class CacheServiceClient {
33803395 http_client_1.HttpCodes.BadGateway,
33813396 http_client_1.HttpCodes.GatewayTimeout,
33823397 http_client_1.HttpCodes.InternalServerError,
3383- http_client_1.HttpCodes.ServiceUnavailable,
3384- http_client_1.HttpCodes.TooManyRequests
3398+ http_client_1.HttpCodes.ServiceUnavailable
33853399 ];
33863400 return retryableStatusCodes.includes(statusCode);
33873401 }
@@ -3417,7 +3431,7 @@ function internalCacheTwirpClient(options) {
34173431"use strict";
34183432
34193433Object.defineProperty(exports, "__esModule", ({ value: true }));
3420- exports.UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
3434+ exports.RateLimitError = exports. UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
34213435class FilesNotFoundError extends Error {
34223436 constructor(files = []) {
34233437 let message = 'No files were found to upload';
@@ -3484,6 +3498,13 @@ UsageError.isUsageErrorMessage = (msg) => {
34843498 return false;
34853499 return msg.includes('insufficient usage');
34863500};
3501+ class RateLimitError extends Error {
3502+ constructor(message) {
3503+ super(message);
3504+ this.name = 'RateLimitError';
3505+ }
3506+ }
3507+ exports.RateLimitError = RateLimitError;
34873508//# sourceMappingURL=errors.js.map
34883509
34893510/***/ }),
@@ -94214,7 +94235,7 @@ function randomUUID() {
9421494235/***/ ((module) => {
9421594236
9421694237"use strict";
94217- module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.2","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.0","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.1","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
94238+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.3","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.0","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.1","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
9421894239
9421994240/***/ })
9422094241
0 commit comments