@@ -2884,6 +2884,18 @@ class CacheServiceClient {
28842884 }
28852885 errorMessage = `${errorMessage}: ${body.msg}`;
28862886 }
2887+ // Handle rate limiting - don't retry, just warn and exit
2888+ // For more info, see https://docs.github.com/en/actions/reference/limits
2889+ if (statusCode === http_client_1.HttpCodes.TooManyRequests) {
2890+ const retryAfterHeader = response.message.headers['retry-after'];
2891+ if (retryAfterHeader) {
2892+ const parsedSeconds = parseInt(retryAfterHeader, 10);
2893+ if (!isNaN(parsedSeconds) && parsedSeconds > 0) {
2894+ (0, core_1.warning)(`You've hit a rate limit, your rate limit will reset in ${parsedSeconds} seconds`);
2895+ }
2896+ }
2897+ throw new errors_1.RateLimitError(`Rate limited: ${errorMessage}`);
2898+ }
28872899 }
28882900 catch (error) {
28892901 if (error instanceof SyntaxError) {
@@ -2892,6 +2904,9 @@ class CacheServiceClient {
28922904 if (error instanceof errors_1.UsageError) {
28932905 throw error;
28942906 }
2907+ if (error instanceof errors_1.RateLimitError) {
2908+ throw error;
2909+ }
28952910 if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
28962911 throw new errors_1.NetworkError(error === null || error === void 0 ? void 0 : error.code);
28972912 }
@@ -2924,8 +2939,7 @@ class CacheServiceClient {
29242939 http_client_1.HttpCodes.BadGateway,
29252940 http_client_1.HttpCodes.GatewayTimeout,
29262941 http_client_1.HttpCodes.InternalServerError,
2927- http_client_1.HttpCodes.ServiceUnavailable,
2928- http_client_1.HttpCodes.TooManyRequests
2942+ http_client_1.HttpCodes.ServiceUnavailable
29292943 ];
29302944 return retryableStatusCodes.includes(statusCode);
29312945 }
@@ -2961,7 +2975,7 @@ function internalCacheTwirpClient(options) {
29612975"use strict";
29622976
29632977Object.defineProperty(exports, "__esModule", ({ value: true }));
2964- exports.UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
2978+ exports.RateLimitError = exports. UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
29652979class FilesNotFoundError extends Error {
29662980 constructor(files = []) {
29672981 let message = 'No files were found to upload';
@@ -3028,6 +3042,13 @@ UsageError.isUsageErrorMessage = (msg) => {
30283042 return false;
30293043 return msg.includes('insufficient usage');
30303044};
3045+ class RateLimitError extends Error {
3046+ constructor(message) {
3047+ super(message);
3048+ this.name = 'RateLimitError';
3049+ }
3050+ }
3051+ exports.RateLimitError = RateLimitError;
30313052//# sourceMappingURL=errors.js.map
30323053
30333054/***/ }),
@@ -91381,7 +91402,7 @@ function randomUUID() {
9138191402/***/ ((module) => {
9138291403
9138391404"use strict";
91384- 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"}}');
91405+ 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"}}');
9138591406
9138691407/***/ })
9138791408
0 commit comments