Skip to content

Commit 2d4e86a

Browse files
committed
npm run package
1 parent efef6ae commit 2d4e86a

File tree

4 files changed

+138
-32
lines changed

4 files changed

+138
-32
lines changed

dist/cache-save/index.js

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const cacheTwirpClient = __importStar(__nccwpck_require__(6819));
4848
const config_1 = __nccwpck_require__(7606);
4949
const tar_1 = __nccwpck_require__(5321);
5050
const constants_1 = __nccwpck_require__(8287);
51+
const http_client_1 = __nccwpck_require__(4844);
5152
class ValidationError extends Error {
5253
constructor(message) {
5354
super(message);
@@ -84,7 +85,17 @@ function checkKey(key) {
8485
* @returns boolean return true if Actions cache service feature is available, otherwise false
8586
*/
8687
function isFeatureAvailable() {
87-
return !!process.env['ACTIONS_CACHE_URL'];
88+
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
89+
// Check availability based on cache service version
90+
switch (cacheServiceVersion) {
91+
case 'v2':
92+
// For v2, we need ACTIONS_RESULTS_URL
93+
return !!process.env['ACTIONS_RESULTS_URL'];
94+
case 'v1':
95+
default:
96+
// For v1, we only need ACTIONS_CACHE_URL
97+
return !!process.env['ACTIONS_CACHE_URL'];
98+
}
8899
}
89100
exports.isFeatureAvailable = isFeatureAvailable;
90101
/**
@@ -169,8 +180,16 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
169180
throw error;
170181
}
171182
else {
172-
// Supress all non-validation cache related errors because caching should be optional
173-
core.warning(`Failed to restore: ${error.message}`);
183+
// warn on cache restore failure and continue build
184+
// Log server errors (5xx) as errors, all other errors as warnings
185+
if (typedError instanceof http_client_1.HttpClientError &&
186+
typeof typedError.statusCode === 'number' &&
187+
typedError.statusCode >= 500) {
188+
core.error(`Failed to restore: ${error.message}`);
189+
}
190+
else {
191+
core.warning(`Failed to restore: ${error.message}`);
192+
}
174193
}
175194
}
176195
finally {
@@ -223,7 +242,13 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
223242
core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`);
224243
return undefined;
225244
}
226-
core.info(`Cache hit for: ${request.key}`);
245+
const isRestoreKeyMatch = request.key !== response.matchedKey;
246+
if (isRestoreKeyMatch) {
247+
core.info(`Cache hit for restore-key: ${response.matchedKey}`);
248+
}
249+
else {
250+
core.info(`Cache hit for: ${response.matchedKey}`);
251+
}
227252
if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
228253
core.info('Lookup only - skipping download');
229254
return response.matchedKey;
@@ -248,7 +273,15 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
248273
}
249274
else {
250275
// Supress all non-validation cache related errors because caching should be optional
251-
core.warning(`Failed to restore: ${error.message}`);
276+
// Log server errors (5xx) as errors, all other errors as warnings
277+
if (typedError instanceof http_client_1.HttpClientError &&
278+
typeof typedError.statusCode === 'number' &&
279+
typedError.statusCode >= 500) {
280+
core.error(`Failed to restore: ${error.message}`);
281+
}
282+
else {
283+
core.warning(`Failed to restore: ${error.message}`);
284+
}
252285
}
253286
}
254287
finally {
@@ -351,7 +384,15 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
351384
core.info(`Failed to save: ${typedError.message}`);
352385
}
353386
else {
354-
core.warning(`Failed to save: ${typedError.message}`);
387+
// Log server errors (5xx) as errors, all other errors as warnings
388+
if (typedError instanceof http_client_1.HttpClientError &&
389+
typeof typedError.statusCode === 'number' &&
390+
typedError.statusCode >= 500) {
391+
core.error(`Failed to save: ${typedError.message}`);
392+
}
393+
else {
394+
core.warning(`Failed to save: ${typedError.message}`);
395+
}
355396
}
356397
}
357398
finally {
@@ -447,7 +488,15 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
447488
core.info(`Failed to save: ${typedError.message}`);
448489
}
449490
else {
450-
core.warning(`Failed to save: ${typedError.message}`);
491+
// Log server errors (5xx) as errors, all other errors as warnings
492+
if (typedError instanceof http_client_1.HttpClientError &&
493+
typeof typedError.statusCode === 'number' &&
494+
typedError.statusCode >= 500) {
495+
core.error(`Failed to save: ${typedError.message}`);
496+
}
497+
else {
498+
core.warning(`Failed to save: ${typedError.message}`);
499+
}
451500
}
452501
}
453502
finally {
@@ -47626,6 +47675,10 @@ class RpcOutputStreamController {
4762647675
cmp: [],
4762747676
};
4762847677
this._closed = false;
47678+
// --- RpcOutputStream async iterator API
47679+
// iterator state.
47680+
// is undefined when no iterator has been acquired yet.
47681+
this._itState = { q: [] };
4762947682
}
4763047683
// --- RpcOutputStream callback API
4763147684
onNext(callback) {
@@ -47725,10 +47778,6 @@ class RpcOutputStreamController {
4772547778
* messages are queued.
4772647779
*/
4772747780
[Symbol.asyncIterator]() {
47728-
// init the iterator state, enabling pushIt()
47729-
if (!this._itState) {
47730-
this._itState = { q: [] };
47731-
}
4773247781
// if we are closed, we are definitely not receiving any more messages.
4773347782
// but we can't let the iterator get stuck. we want to either:
4773447783
// a) finish the new iterator immediately, because we are completed
@@ -47761,8 +47810,6 @@ class RpcOutputStreamController {
4776147810
// this either resolves a pending promise, or enqueues the result.
4776247811
pushIt(result) {
4776347812
let state = this._itState;
47764-
if (!state)
47765-
return;
4776647813
// is the consumer waiting for us?
4776747814
if (state.p) {
4776847815
// yes, consumer is waiting for this promise.
@@ -49674,6 +49721,7 @@ const reflection_equals_1 = __nccwpck_require__(4827);
4967449721
const binary_writer_1 = __nccwpck_require__(3957);
4967549722
const binary_reader_1 = __nccwpck_require__(2889);
4967649723
const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
49724+
const messageTypeDescriptor = baseDescriptors[message_type_contract_1.MESSAGE_TYPE] = {};
4967749725
/**
4967849726
* This standard message type provides reflection-based
4967949727
* operations to work with a message.
@@ -49684,7 +49732,8 @@ class MessageType {
4968449732
this.typeName = name;
4968549733
this.fields = fields.map(reflection_info_1.normalizeFieldInfo);
4968649734
this.options = options !== null && options !== void 0 ? options : {};
49687-
this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [message_type_contract_1.MESSAGE_TYPE]: { value: this } }));
49735+
messageTypeDescriptor.value = this;
49736+
this.messagePrototype = Object.create(null, baseDescriptors);
4968849737
this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this);
4968949738
this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this);
4969049739
this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this);
@@ -51201,12 +51250,16 @@ class ReflectionJsonReader {
5120151250
target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]);
5120251251
break;
5120351252
case "enum":
51253+
if (jsonValue === null)
51254+
continue;
5120451255
let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields);
5120551256
if (val === false)
5120651257
continue;
5120751258
target[localName] = val;
5120851259
break;
5120951260
case "scalar":
51261+
if (jsonValue === null)
51262+
continue;
5121051263
target[localName] = this.scalar(jsonValue, field.T, field.L, field.name);
5121151264
break;
5121251265
}
@@ -93352,7 +93405,7 @@ module.exports = parseParams
9335293405
/***/ ((module) => {
9335393406

9335493407
"use strict";
93355-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.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":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
93408+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.5","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":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"}}');
9335693409

9335793410
/***/ }),
9335893411

dist/cache-save/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)