@@ -2398,6 +2398,18 @@ class CacheServiceClient {
23982398 }
23992399 errorMessage = `${errorMessage}: ${body.msg}`;
24002400 }
2401+ // Handle rate limiting - don't retry, just warn and exit
2402+ // For more info, see https://docs.github.com/en/actions/reference/limits
2403+ if (statusCode === http_client_1.HttpCodes.TooManyRequests) {
2404+ const retryAfterHeader = response.message.headers['retry-after'];
2405+ if (retryAfterHeader) {
2406+ const parsedSeconds = parseInt(retryAfterHeader, 10);
2407+ if (!isNaN(parsedSeconds) && parsedSeconds > 0) {
2408+ (0, core_1.warning)(`You've hit a rate limit, your rate limit will reset in ${parsedSeconds} seconds`);
2409+ }
2410+ }
2411+ throw new errors_1.RateLimitError(`Rate limited: ${errorMessage}`);
2412+ }
24012413 }
24022414 catch (error) {
24032415 if (error instanceof SyntaxError) {
@@ -2406,6 +2418,9 @@ class CacheServiceClient {
24062418 if (error instanceof errors_1.UsageError) {
24072419 throw error;
24082420 }
2421+ if (error instanceof errors_1.RateLimitError) {
2422+ throw error;
2423+ }
24092424 if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
24102425 throw new errors_1.NetworkError(error === null || error === void 0 ? void 0 : error.code);
24112426 }
@@ -2438,8 +2453,7 @@ class CacheServiceClient {
24382453 http_client_1.HttpCodes.BadGateway,
24392454 http_client_1.HttpCodes.GatewayTimeout,
24402455 http_client_1.HttpCodes.InternalServerError,
2441- http_client_1.HttpCodes.ServiceUnavailable,
2442- http_client_1.HttpCodes.TooManyRequests
2456+ http_client_1.HttpCodes.ServiceUnavailable
24432457 ];
24442458 return retryableStatusCodes.includes(statusCode);
24452459 }
@@ -2475,7 +2489,7 @@ function internalCacheTwirpClient(options) {
24752489"use strict";
24762490
24772491Object.defineProperty(exports, "__esModule", ({ value: true }));
2478- exports.UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
2492+ exports.RateLimitError = exports. UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
24792493class FilesNotFoundError extends Error {
24802494 constructor(files = []) {
24812495 let message = 'No files were found to upload';
@@ -2542,6 +2556,13 @@ UsageError.isUsageErrorMessage = (msg) => {
25422556 return false;
25432557 return msg.includes('insufficient usage');
25442558};
2559+ class RateLimitError extends Error {
2560+ constructor(message) {
2561+ super(message);
2562+ this.name = 'RateLimitError';
2563+ }
2564+ }
2565+ exports.RateLimitError = RateLimitError;
25452566//# sourceMappingURL=errors.js.map
25462567
25472568/***/ }),
@@ -9902,7 +9923,7 @@ class HttpClient {
99029923 this._maxRetries = 1;
99039924 this._keepAlive = false;
99049925 this._disposed = false;
9905- this.userAgent = userAgent;
9926+ this.userAgent = this._getUserAgentWithOrchestrationId( userAgent) ;
99069927 this.handlers = handlers || [];
99079928 this.requestOptions = requestOptions;
99089929 if (requestOptions) {
@@ -10382,6 +10403,17 @@ class HttpClient {
1038210403 }
1038310404 return proxyAgent;
1038410405 }
10406+ _getUserAgentWithOrchestrationId(userAgent) {
10407+ const baseUserAgent = userAgent || 'actions/http-client';
10408+ const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
10409+ if (orchId) {
10410+ // Sanitize the orchestration ID to ensure it contains only valid characters
10411+ // Valid characters: 0-9, a-z, _, -, .
10412+ const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
10413+ return `${baseUserAgent} actions_orchestration_id/${sanitizedId}`;
10414+ }
10415+ return baseUserAgent;
10416+ }
1038510417 _performExponentialBackoff(retryNumber) {
1038610418 return __awaiter(this, void 0, void 0, function* () {
1038710419 retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
@@ -87398,7 +87430,7 @@ function randomUUID() {
8739887430/***/ ((module) => {
8739987431
8740087432"use strict";
87401- module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.1","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.0","@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"}}');
87433+ 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"}}');
8740287434
8740387435/***/ })
8740487436
0 commit comments