@kitsi/action 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -96291,10 +96291,10 @@ var require_semver = __commonJS((exports, module) => {
96291
96291
  }
96292
96292
  });
96293
96293
 
96294
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/internal/constants.js
96294
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/constants.js
96295
96295
  var require_constants13 = __commonJS((exports) => {
96296
96296
  Object.defineProperty(exports, "__esModule", { value: true });
96297
- exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = undefined;
96297
+ exports.CacheFileSizeLimit = exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = undefined;
96298
96298
  var CacheFilename;
96299
96299
  (function(CacheFilename2) {
96300
96300
  CacheFilename2["Gzip"] = "cache.tgz";
@@ -96318,9 +96318,10 @@ var require_constants13 = __commonJS((exports) => {
96318
96318
  exports.SystemTarPathOnWindows = `${process.env["SYSTEMDRIVE"]}\\Windows\\System32\\tar.exe`;
96319
96319
  exports.TarFilename = "cache.tar";
96320
96320
  exports.ManifestFilename = "manifest.txt";
96321
+ exports.CacheFileSizeLimit = 10 * Math.pow(1024, 3);
96321
96322
  });
96322
96323
 
96323
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/internal/cacheUtils.js
96324
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/cacheUtils.js
96324
96325
  var require_cacheUtils = __commonJS((exports) => {
96325
96326
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
96326
96327
  if (k2 === undefined)
@@ -96402,7 +96403,7 @@ var require_cacheUtils = __commonJS((exports) => {
96402
96403
  }
96403
96404
  };
96404
96405
  Object.defineProperty(exports, "__esModule", { value: true });
96405
- exports.isGhes = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = undefined;
96406
+ exports.getRuntimeToken = exports.getCacheVersion = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = undefined;
96406
96407
  var core2 = __importStar(require_core());
96407
96408
  var exec = __importStar(require_exec());
96408
96409
  var glob2 = __importStar(require_glob3());
@@ -96413,6 +96414,7 @@ var require_cacheUtils = __commonJS((exports) => {
96413
96414
  var semver = __importStar(require_semver());
96414
96415
  var util = __importStar(__require("util"));
96415
96416
  var constants_1 = require_constants13();
96417
+ var versionSalt = "1.0";
96416
96418
  function createTempDirectory() {
96417
96419
  return __awaiter(this, undefined, undefined, function* () {
96418
96420
  const IS_WINDOWS = process.platform === "win32";
@@ -96540,17 +96542,259 @@ var require_cacheUtils = __commonJS((exports) => {
96540
96542
  return value;
96541
96543
  }
96542
96544
  exports.assertDefined = assertDefined;
96543
- function isGhes() {
96544
- const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
96545
- const hostname = ghUrl.hostname.trimEnd().toUpperCase();
96546
- const isGitHubHost = hostname === "GITHUB.COM";
96547
- const isGheHost = hostname.endsWith(".GHE.COM") || hostname.endsWith(".GHE.LOCALHOST");
96548
- return !isGitHubHost && !isGheHost;
96545
+ function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
96546
+ const components = paths.slice();
96547
+ if (compressionMethod) {
96548
+ components.push(compressionMethod);
96549
+ }
96550
+ if (process.platform === "win32" && !enableCrossOsArchive) {
96551
+ components.push("windows-only");
96552
+ }
96553
+ components.push(versionSalt);
96554
+ return crypto2.createHash("sha256").update(components.join("|")).digest("hex");
96549
96555
  }
96550
- exports.isGhes = isGhes;
96556
+ exports.getCacheVersion = getCacheVersion;
96557
+ function getRuntimeToken() {
96558
+ const token = process.env["ACTIONS_RUNTIME_TOKEN"];
96559
+ if (!token) {
96560
+ throw new Error("Unable to get the ACTIONS_RUNTIME_TOKEN env variable");
96561
+ }
96562
+ return token;
96563
+ }
96564
+ exports.getRuntimeToken = getRuntimeToken;
96565
+ });
96566
+
96567
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/shared/errors.js
96568
+ var require_errors4 = __commonJS((exports) => {
96569
+ Object.defineProperty(exports, "__esModule", { value: true });
96570
+ exports.UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = undefined;
96571
+
96572
+ class FilesNotFoundError extends Error {
96573
+ constructor(files = []) {
96574
+ let message = "No files were found to upload";
96575
+ if (files.length > 0) {
96576
+ message += `: ${files.join(", ")}`;
96577
+ }
96578
+ super(message);
96579
+ this.files = files;
96580
+ this.name = "FilesNotFoundError";
96581
+ }
96582
+ }
96583
+ exports.FilesNotFoundError = FilesNotFoundError;
96584
+
96585
+ class InvalidResponseError extends Error {
96586
+ constructor(message) {
96587
+ super(message);
96588
+ this.name = "InvalidResponseError";
96589
+ }
96590
+ }
96591
+ exports.InvalidResponseError = InvalidResponseError;
96592
+
96593
+ class CacheNotFoundError extends Error {
96594
+ constructor(message = "Cache not found") {
96595
+ super(message);
96596
+ this.name = "CacheNotFoundError";
96597
+ }
96598
+ }
96599
+ exports.CacheNotFoundError = CacheNotFoundError;
96600
+
96601
+ class GHESNotSupportedError extends Error {
96602
+ constructor(message = "@actions/cache v4.1.4+, actions/cache/save@v4+ and actions/cache/restore@v4+ are not currently supported on GHES.") {
96603
+ super(message);
96604
+ this.name = "GHESNotSupportedError";
96605
+ }
96606
+ }
96607
+ exports.GHESNotSupportedError = GHESNotSupportedError;
96608
+
96609
+ class NetworkError extends Error {
96610
+ constructor(code) {
96611
+ const message = `Unable to make request: ${code}
96612
+ If you are using self-hosted runners, please make sure your runner has access to all GitHub endpoints: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github`;
96613
+ super(message);
96614
+ this.code = code;
96615
+ this.name = "NetworkError";
96616
+ }
96617
+ }
96618
+ exports.NetworkError = NetworkError;
96619
+ NetworkError.isNetworkErrorCode = (code) => {
96620
+ if (!code)
96621
+ return false;
96622
+ return [
96623
+ "ECONNRESET",
96624
+ "ENOTFOUND",
96625
+ "ETIMEDOUT",
96626
+ "ECONNREFUSED",
96627
+ "EHOSTUNREACH"
96628
+ ].includes(code);
96629
+ };
96630
+
96631
+ class UsageError extends Error {
96632
+ constructor() {
96633
+ const message = `Cache storage quota has been hit. Unable to upload any new cache entries. Usage is recalculated every 6-12 hours.
96634
+ More info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`;
96635
+ super(message);
96636
+ this.name = "UsageError";
96637
+ }
96638
+ }
96639
+ exports.UsageError = UsageError;
96640
+ UsageError.isUsageErrorMessage = (msg) => {
96641
+ if (!msg)
96642
+ return false;
96643
+ return msg.includes("insufficient usage");
96644
+ };
96645
+ });
96646
+
96647
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/uploadUtils.js
96648
+ var require_uploadUtils = __commonJS((exports) => {
96649
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
96650
+ if (k2 === undefined)
96651
+ k2 = k;
96652
+ var desc = Object.getOwnPropertyDescriptor(m, k);
96653
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
96654
+ desc = { enumerable: true, get: function() {
96655
+ return m[k];
96656
+ } };
96657
+ }
96658
+ Object.defineProperty(o, k2, desc);
96659
+ } : function(o, m, k, k2) {
96660
+ if (k2 === undefined)
96661
+ k2 = k;
96662
+ o[k2] = m[k];
96663
+ });
96664
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
96665
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
96666
+ } : function(o, v) {
96667
+ o["default"] = v;
96668
+ });
96669
+ var __importStar = exports && exports.__importStar || function(mod) {
96670
+ if (mod && mod.__esModule)
96671
+ return mod;
96672
+ var result = {};
96673
+ if (mod != null) {
96674
+ for (var k in mod)
96675
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
96676
+ __createBinding(result, mod, k);
96677
+ }
96678
+ __setModuleDefault(result, mod);
96679
+ return result;
96680
+ };
96681
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
96682
+ function adopt(value) {
96683
+ return value instanceof P ? value : new P(function(resolve) {
96684
+ resolve(value);
96685
+ });
96686
+ }
96687
+ return new (P || (P = Promise))(function(resolve, reject) {
96688
+ function fulfilled(value) {
96689
+ try {
96690
+ step(generator.next(value));
96691
+ } catch (e) {
96692
+ reject(e);
96693
+ }
96694
+ }
96695
+ function rejected(value) {
96696
+ try {
96697
+ step(generator["throw"](value));
96698
+ } catch (e) {
96699
+ reject(e);
96700
+ }
96701
+ }
96702
+ function step(result) {
96703
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
96704
+ }
96705
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
96706
+ });
96707
+ };
96708
+ Object.defineProperty(exports, "__esModule", { value: true });
96709
+ exports.uploadCacheArchiveSDK = exports.UploadProgress = undefined;
96710
+ var core2 = __importStar(require_core());
96711
+ var storage_blob_1 = require_commonjs15();
96712
+ var errors_1 = require_errors4();
96713
+
96714
+ class UploadProgress {
96715
+ constructor(contentLength) {
96716
+ this.contentLength = contentLength;
96717
+ this.sentBytes = 0;
96718
+ this.displayedComplete = false;
96719
+ this.startTime = Date.now();
96720
+ }
96721
+ setSentBytes(sentBytes) {
96722
+ this.sentBytes = sentBytes;
96723
+ }
96724
+ getTransferredBytes() {
96725
+ return this.sentBytes;
96726
+ }
96727
+ isDone() {
96728
+ return this.getTransferredBytes() === this.contentLength;
96729
+ }
96730
+ display() {
96731
+ if (this.displayedComplete) {
96732
+ return;
96733
+ }
96734
+ const transferredBytes = this.sentBytes;
96735
+ const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
96736
+ const elapsedTime = Date.now() - this.startTime;
96737
+ const uploadSpeed = (transferredBytes / (1024 * 1024) / (elapsedTime / 1000)).toFixed(1);
96738
+ core2.info(`Sent ${transferredBytes} of ${this.contentLength} (${percentage}%), ${uploadSpeed} MBs/sec`);
96739
+ if (this.isDone()) {
96740
+ this.displayedComplete = true;
96741
+ }
96742
+ }
96743
+ onProgress() {
96744
+ return (progress) => {
96745
+ this.setSentBytes(progress.loadedBytes);
96746
+ };
96747
+ }
96748
+ startDisplayTimer(delayInMs = 1000) {
96749
+ const displayCallback = () => {
96750
+ this.display();
96751
+ if (!this.isDone()) {
96752
+ this.timeoutHandle = setTimeout(displayCallback, delayInMs);
96753
+ }
96754
+ };
96755
+ this.timeoutHandle = setTimeout(displayCallback, delayInMs);
96756
+ }
96757
+ stopDisplayTimer() {
96758
+ if (this.timeoutHandle) {
96759
+ clearTimeout(this.timeoutHandle);
96760
+ this.timeoutHandle = undefined;
96761
+ }
96762
+ this.display();
96763
+ }
96764
+ }
96765
+ exports.UploadProgress = UploadProgress;
96766
+ function uploadCacheArchiveSDK(signedUploadURL, archivePath, options) {
96767
+ var _a;
96768
+ return __awaiter(this, undefined, undefined, function* () {
96769
+ const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
96770
+ const blockBlobClient = blobClient.getBlockBlobClient();
96771
+ const uploadProgress = new UploadProgress((_a = options === null || options === undefined ? undefined : options.archiveSizeBytes) !== null && _a !== undefined ? _a : 0);
96772
+ const uploadOptions = {
96773
+ blockSize: options === null || options === undefined ? undefined : options.uploadChunkSize,
96774
+ concurrency: options === null || options === undefined ? undefined : options.uploadConcurrency,
96775
+ maxSingleShotSize: 128 * 1024 * 1024,
96776
+ onProgress: uploadProgress.onProgress()
96777
+ };
96778
+ try {
96779
+ uploadProgress.startDisplayTimer();
96780
+ core2.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
96781
+ const response = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
96782
+ if (response._response.status >= 400) {
96783
+ throw new errors_1.InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${response._response.status}`);
96784
+ }
96785
+ return response;
96786
+ } catch (error2) {
96787
+ core2.warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${error2.message}`);
96788
+ throw error2;
96789
+ } finally {
96790
+ uploadProgress.stopDisplayTimer();
96791
+ }
96792
+ });
96793
+ }
96794
+ exports.uploadCacheArchiveSDK = uploadCacheArchiveSDK;
96551
96795
  });
96552
96796
 
96553
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/internal/requestUtils.js
96797
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/requestUtils.js
96554
96798
  var require_requestUtils = __commonJS((exports) => {
96555
96799
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
96556
96800
  if (k2 === undefined)
@@ -96815,7 +97059,7 @@ var require_dist5 = __commonJS((exports) => {
96815
97059
  exports.AbortSignal = AbortSignal2;
96816
97060
  });
96817
97061
 
96818
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/internal/downloadUtils.js
97062
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/downloadUtils.js
96819
97063
  var require_downloadUtils = __commonJS((exports) => {
96820
97064
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
96821
97065
  if (k2 === undefined)
@@ -97142,7 +97386,7 @@ var require_downloadUtils = __commonJS((exports) => {
97142
97386
  });
97143
97387
  });
97144
97388
 
97145
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/options.js
97389
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/options.js
97146
97390
  var require_options = __commonJS((exports) => {
97147
97391
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
97148
97392
  if (k2 === undefined)
@@ -97181,10 +97425,14 @@ var require_options = __commonJS((exports) => {
97181
97425
  var core2 = __importStar(require_core());
97182
97426
  function getUploadOptions(copy) {
97183
97427
  const result = {
97428
+ useAzureSdk: false,
97184
97429
  uploadConcurrency: 4,
97185
97430
  uploadChunkSize: 32 * 1024 * 1024
97186
97431
  };
97187
97432
  if (copy) {
97433
+ if (typeof copy.useAzureSdk === "boolean") {
97434
+ result.useAzureSdk = copy.useAzureSdk;
97435
+ }
97188
97436
  if (typeof copy.uploadConcurrency === "number") {
97189
97437
  result.uploadConcurrency = copy.uploadConcurrency;
97190
97438
  }
@@ -97192,6 +97440,9 @@ var require_options = __commonJS((exports) => {
97192
97440
  result.uploadChunkSize = copy.uploadChunkSize;
97193
97441
  }
97194
97442
  }
97443
+ result.uploadConcurrency = !isNaN(Number(process.env["CACHE_UPLOAD_CONCURRENCY"])) ? Math.min(32, Number(process.env["CACHE_UPLOAD_CONCURRENCY"])) : result.uploadConcurrency;
97444
+ result.uploadChunkSize = !isNaN(Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"])) ? Math.min(128 * 1024 * 1024, Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]) * 1024 * 1024) : result.uploadChunkSize;
97445
+ core2.debug(`Use Azure SDK: ${result.useAzureSdk}`);
97195
97446
  core2.debug(`Upload concurrency: ${result.uploadConcurrency}`);
97196
97447
  core2.debug(`Upload chunk size: ${result.uploadChunkSize}`);
97197
97448
  return result;
@@ -97241,32 +97492,137 @@ var require_options = __commonJS((exports) => {
97241
97492
  exports.getDownloadOptions = getDownloadOptions;
97242
97493
  });
97243
97494
 
97244
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/internal/cacheHttpClient.js
97245
- var require_cacheHttpClient = __commonJS((exports) => {
97246
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
97247
- if (k2 === undefined)
97248
- k2 = k;
97249
- var desc = Object.getOwnPropertyDescriptor(m, k);
97250
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
97251
- desc = { enumerable: true, get: function() {
97252
- return m[k];
97253
- } };
97495
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/config.js
97496
+ var require_config2 = __commonJS((exports) => {
97497
+ Object.defineProperty(exports, "__esModule", { value: true });
97498
+ exports.getCacheServiceURL = exports.getCacheServiceVersion = exports.isGhes = undefined;
97499
+ function isGhes() {
97500
+ const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
97501
+ const hostname = ghUrl.hostname.trimEnd().toUpperCase();
97502
+ const isGitHubHost = hostname === "GITHUB.COM";
97503
+ const isGheHost = hostname.endsWith(".GHE.COM");
97504
+ const isLocalHost = hostname.endsWith(".LOCALHOST");
97505
+ return !isGitHubHost && !isGheHost && !isLocalHost;
97506
+ }
97507
+ exports.isGhes = isGhes;
97508
+ function getCacheServiceVersion() {
97509
+ if (isGhes())
97510
+ return "v1";
97511
+ return process.env["ACTIONS_CACHE_SERVICE_V2"] ? "v2" : "v1";
97512
+ }
97513
+ exports.getCacheServiceVersion = getCacheServiceVersion;
97514
+ function getCacheServiceURL() {
97515
+ const version = getCacheServiceVersion();
97516
+ switch (version) {
97517
+ case "v1":
97518
+ return process.env["ACTIONS_CACHE_URL"] || process.env["ACTIONS_RESULTS_URL"] || "";
97519
+ case "v2":
97520
+ return process.env["ACTIONS_RESULTS_URL"] || "";
97521
+ default:
97522
+ throw new Error(`Unsupported cache service version: ${version}`);
97254
97523
  }
97255
- Object.defineProperty(o, k2, desc);
97256
- } : function(o, m, k, k2) {
97257
- if (k2 === undefined)
97258
- k2 = k;
97259
- o[k2] = m[k];
97260
- });
97261
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
97262
- Object.defineProperty(o, "default", { enumerable: true, value: v });
97263
- } : function(o, v) {
97264
- o["default"] = v;
97265
- });
97266
- var __importStar = exports && exports.__importStar || function(mod) {
97267
- if (mod && mod.__esModule)
97268
- return mod;
97269
- var result = {};
97524
+ }
97525
+ exports.getCacheServiceURL = getCacheServiceURL;
97526
+ });
97527
+
97528
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/package.json
97529
+ var require_package2 = __commonJS((exports, module) => {
97530
+ module.exports = {
97531
+ name: "@actions/cache",
97532
+ version: "4.1.0",
97533
+ preview: true,
97534
+ description: "Actions cache lib",
97535
+ keywords: [
97536
+ "github",
97537
+ "actions",
97538
+ "cache"
97539
+ ],
97540
+ homepage: "https://github.com/actions/toolkit/tree/main/packages/cache",
97541
+ license: "MIT",
97542
+ main: "lib/cache.js",
97543
+ types: "lib/cache.d.ts",
97544
+ directories: {
97545
+ lib: "lib",
97546
+ test: "__tests__"
97547
+ },
97548
+ files: [
97549
+ "lib",
97550
+ "!.DS_Store"
97551
+ ],
97552
+ publishConfig: {
97553
+ access: "public"
97554
+ },
97555
+ repository: {
97556
+ type: "git",
97557
+ url: "git+https://github.com/actions/toolkit.git",
97558
+ directory: "packages/cache"
97559
+ },
97560
+ scripts: {
97561
+ "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
97562
+ test: 'echo "Error: run tests from root" && exit 1',
97563
+ tsc: "tsc"
97564
+ },
97565
+ bugs: {
97566
+ url: "https://github.com/actions/toolkit/issues"
97567
+ },
97568
+ dependencies: {
97569
+ "@actions/core": "^1.11.1",
97570
+ "@actions/exec": "^1.0.1",
97571
+ "@actions/glob": "^0.1.0",
97572
+ "@protobuf-ts/runtime-rpc": "^2.11.1",
97573
+ "@actions/http-client": "^2.1.1",
97574
+ "@actions/io": "^1.0.1",
97575
+ "@azure/abort-controller": "^1.1.0",
97576
+ "@azure/ms-rest-js": "^2.6.0",
97577
+ "@azure/storage-blob": "^12.13.0",
97578
+ semver: "^6.3.1"
97579
+ },
97580
+ devDependencies: {
97581
+ "@types/node": "^22.13.9",
97582
+ "@types/semver": "^6.0.0",
97583
+ "@protobuf-ts/plugin": "^2.9.4",
97584
+ typescript: "^5.2.2"
97585
+ }
97586
+ };
97587
+ });
97588
+
97589
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/shared/user-agent.js
97590
+ var require_user_agent2 = __commonJS((exports) => {
97591
+ Object.defineProperty(exports, "__esModule", { value: true });
97592
+ exports.getUserAgentString = undefined;
97593
+ var packageJson = require_package2();
97594
+ function getUserAgentString() {
97595
+ return `@actions/cache-${packageJson.version}`;
97596
+ }
97597
+ exports.getUserAgentString = getUserAgentString;
97598
+ });
97599
+
97600
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/cacheHttpClient.js
97601
+ var require_cacheHttpClient = __commonJS((exports) => {
97602
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
97603
+ if (k2 === undefined)
97604
+ k2 = k;
97605
+ var desc = Object.getOwnPropertyDescriptor(m, k);
97606
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
97607
+ desc = { enumerable: true, get: function() {
97608
+ return m[k];
97609
+ } };
97610
+ }
97611
+ Object.defineProperty(o, k2, desc);
97612
+ } : function(o, m, k, k2) {
97613
+ if (k2 === undefined)
97614
+ k2 = k;
97615
+ o[k2] = m[k];
97616
+ });
97617
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
97618
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
97619
+ } : function(o, v) {
97620
+ o["default"] = v;
97621
+ });
97622
+ var __importStar = exports && exports.__importStar || function(mod) {
97623
+ if (mod && mod.__esModule)
97624
+ return mod;
97625
+ var result = {};
97270
97626
  if (mod != null) {
97271
97627
  for (var k in mod)
97272
97628
  if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
@@ -97303,20 +97659,21 @@ var require_cacheHttpClient = __commonJS((exports) => {
97303
97659
  });
97304
97660
  };
97305
97661
  Object.defineProperty(exports, "__esModule", { value: true });
97306
- exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = exports.getCacheVersion = undefined;
97662
+ exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = undefined;
97307
97663
  var core2 = __importStar(require_core());
97308
97664
  var http_client_1 = require_lib();
97309
97665
  var auth_1 = require_auth();
97310
- var crypto2 = __importStar(__require("crypto"));
97311
97666
  var fs = __importStar(__require("fs"));
97312
97667
  var url_1 = __require("url");
97313
97668
  var utils = __importStar(require_cacheUtils());
97669
+ var uploadUtils_1 = require_uploadUtils();
97314
97670
  var downloadUtils_1 = require_downloadUtils();
97315
97671
  var options_1 = require_options();
97316
97672
  var requestUtils_1 = require_requestUtils();
97317
- var versionSalt = "1.0";
97673
+ var config_1 = require_config2();
97674
+ var user_agent_1 = require_user_agent2();
97318
97675
  function getCacheApiUrl(resource) {
97319
- const baseUrl = process.env["ACTIONS_CACHE_URL"] || "";
97676
+ const baseUrl = (0, config_1.getCacheServiceURL)();
97320
97677
  if (!baseUrl) {
97321
97678
  throw new Error("Cache Service Url not found, unable to restore cache.");
97322
97679
  }
@@ -97338,24 +97695,12 @@ var require_cacheHttpClient = __commonJS((exports) => {
97338
97695
  function createHttpClient() {
97339
97696
  const token = process.env["ACTIONS_RUNTIME_TOKEN"] || "";
97340
97697
  const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
97341
- return new http_client_1.HttpClient("actions/cache", [bearerCredentialHandler], getRequestOptions());
97342
- }
97343
- function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
97344
- const components = paths.slice();
97345
- if (compressionMethod) {
97346
- components.push(compressionMethod);
97347
- }
97348
- if (process.platform === "win32" && !enableCrossOsArchive) {
97349
- components.push("windows-only");
97350
- }
97351
- components.push(versionSalt);
97352
- return crypto2.createHash("sha256").update(components.join("|")).digest("hex");
97698
+ return new http_client_1.HttpClient((0, user_agent_1.getUserAgentString)(), [bearerCredentialHandler], getRequestOptions());
97353
97699
  }
97354
- exports.getCacheVersion = getCacheVersion;
97355
97700
  function getCacheEntry(keys, paths, options) {
97356
97701
  return __awaiter(this, undefined, undefined, function* () {
97357
97702
  const httpClient = createHttpClient();
97358
- const version = getCacheVersion(paths, options === null || options === undefined ? undefined : options.compressionMethod, options === null || options === undefined ? undefined : options.enableCrossOsArchive);
97703
+ const version = utils.getCacheVersion(paths, options === null || options === undefined ? undefined : options.compressionMethod, options === null || options === undefined ? undefined : options.enableCrossOsArchive);
97359
97704
  const resource = `cache?keys=${encodeURIComponent(keys.join(","))}&version=${version}`;
97360
97705
  const response = yield (0, requestUtils_1.retryTypedResponse)("getCacheEntry", () => __awaiter(this, undefined, undefined, function* () {
97361
97706
  return httpClient.getJson(getCacheApiUrl(resource));
@@ -97421,7 +97766,7 @@ Other caches with similar key:`);
97421
97766
  function reserveCache(key, paths, options) {
97422
97767
  return __awaiter(this, undefined, undefined, function* () {
97423
97768
  const httpClient = createHttpClient();
97424
- const version = getCacheVersion(paths, options === null || options === undefined ? undefined : options.compressionMethod, options === null || options === undefined ? undefined : options.enableCrossOsArchive);
97769
+ const version = utils.getCacheVersion(paths, options === null || options === undefined ? undefined : options.compressionMethod, options === null || options === undefined ? undefined : options.enableCrossOsArchive);
97425
97770
  const reserveCacheRequest = {
97426
97771
  key,
97427
97772
  version,
@@ -97479,40 +97824,809 @@ Other caches with similar key:`);
97479
97824
  throw new Error(`Cache upload failed because file read failed with ${error2.message}`);
97480
97825
  }), start, end);
97481
97826
  }
97482
- })));
97483
- } finally {
97484
- fs.closeSync(fd);
97827
+ })));
97828
+ } finally {
97829
+ fs.closeSync(fd);
97830
+ }
97831
+ return;
97832
+ });
97833
+ }
97834
+ function commitCache(httpClient, cacheId, filesize) {
97835
+ return __awaiter(this, undefined, undefined, function* () {
97836
+ const commitCacheRequest = { size: filesize };
97837
+ return yield (0, requestUtils_1.retryTypedResponse)("commitCache", () => __awaiter(this, undefined, undefined, function* () {
97838
+ return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
97839
+ }));
97840
+ });
97841
+ }
97842
+ function saveCache(cacheId, archivePath, signedUploadURL, options) {
97843
+ return __awaiter(this, undefined, undefined, function* () {
97844
+ const uploadOptions = (0, options_1.getUploadOptions)(options);
97845
+ if (uploadOptions.useAzureSdk) {
97846
+ if (!signedUploadURL) {
97847
+ throw new Error("Azure Storage SDK can only be used when a signed URL is provided.");
97848
+ }
97849
+ yield (0, uploadUtils_1.uploadCacheArchiveSDK)(signedUploadURL, archivePath, options);
97850
+ } else {
97851
+ const httpClient = createHttpClient();
97852
+ core2.debug("Upload cache");
97853
+ yield uploadFile(httpClient, cacheId, archivePath, options);
97854
+ core2.debug("Commiting cache");
97855
+ const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
97856
+ core2.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
97857
+ const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
97858
+ if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) {
97859
+ throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
97860
+ }
97861
+ core2.info("Cache saved successfully");
97862
+ }
97863
+ });
97864
+ }
97865
+ exports.saveCache = saveCache;
97866
+ });
97867
+
97868
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/generated/results/entities/v1/cachescope.js
97869
+ var require_cachescope = __commonJS((exports) => {
97870
+ Object.defineProperty(exports, "__esModule", { value: true });
97871
+ exports.CacheScope = undefined;
97872
+ var runtime_1 = require_commonjs();
97873
+ var runtime_2 = require_commonjs();
97874
+ var runtime_3 = require_commonjs();
97875
+ var runtime_4 = require_commonjs();
97876
+ var runtime_5 = require_commonjs();
97877
+
97878
+ class CacheScope$Type extends runtime_5.MessageType {
97879
+ constructor() {
97880
+ super("github.actions.results.entities.v1.CacheScope", [
97881
+ { no: 1, name: "scope", kind: "scalar", T: 9 },
97882
+ { no: 2, name: "permission", kind: "scalar", T: 3 }
97883
+ ]);
97884
+ }
97885
+ create(value) {
97886
+ const message = { scope: "", permission: "0" };
97887
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
97888
+ if (value !== undefined)
97889
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
97890
+ return message;
97891
+ }
97892
+ internalBinaryRead(reader, length, options, target) {
97893
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
97894
+ while (reader.pos < end) {
97895
+ let [fieldNo, wireType] = reader.tag();
97896
+ switch (fieldNo) {
97897
+ case 1:
97898
+ message.scope = reader.string();
97899
+ break;
97900
+ case 2:
97901
+ message.permission = reader.int64().toString();
97902
+ break;
97903
+ default:
97904
+ let u = options.readUnknownField;
97905
+ if (u === "throw")
97906
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
97907
+ let d = reader.skip(wireType);
97908
+ if (u !== false)
97909
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
97910
+ }
97911
+ }
97912
+ return message;
97913
+ }
97914
+ internalBinaryWrite(message, writer, options) {
97915
+ if (message.scope !== "")
97916
+ writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.scope);
97917
+ if (message.permission !== "0")
97918
+ writer.tag(2, runtime_1.WireType.Varint).int64(message.permission);
97919
+ let u = options.writeUnknownFields;
97920
+ if (u !== false)
97921
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
97922
+ return writer;
97923
+ }
97924
+ }
97925
+ exports.CacheScope = new CacheScope$Type;
97926
+ });
97927
+
97928
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/generated/results/entities/v1/cachemetadata.js
97929
+ var require_cachemetadata = __commonJS((exports) => {
97930
+ Object.defineProperty(exports, "__esModule", { value: true });
97931
+ exports.CacheMetadata = undefined;
97932
+ var runtime_1 = require_commonjs();
97933
+ var runtime_2 = require_commonjs();
97934
+ var runtime_3 = require_commonjs();
97935
+ var runtime_4 = require_commonjs();
97936
+ var runtime_5 = require_commonjs();
97937
+ var cachescope_1 = require_cachescope();
97938
+
97939
+ class CacheMetadata$Type extends runtime_5.MessageType {
97940
+ constructor() {
97941
+ super("github.actions.results.entities.v1.CacheMetadata", [
97942
+ { no: 1, name: "repository_id", kind: "scalar", T: 3 },
97943
+ { no: 2, name: "scope", kind: "message", repeat: 1, T: () => cachescope_1.CacheScope }
97944
+ ]);
97945
+ }
97946
+ create(value) {
97947
+ const message = { repositoryId: "0", scope: [] };
97948
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
97949
+ if (value !== undefined)
97950
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
97951
+ return message;
97952
+ }
97953
+ internalBinaryRead(reader, length, options, target) {
97954
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
97955
+ while (reader.pos < end) {
97956
+ let [fieldNo, wireType] = reader.tag();
97957
+ switch (fieldNo) {
97958
+ case 1:
97959
+ message.repositoryId = reader.int64().toString();
97960
+ break;
97961
+ case 2:
97962
+ message.scope.push(cachescope_1.CacheScope.internalBinaryRead(reader, reader.uint32(), options));
97963
+ break;
97964
+ default:
97965
+ let u = options.readUnknownField;
97966
+ if (u === "throw")
97967
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
97968
+ let d = reader.skip(wireType);
97969
+ if (u !== false)
97970
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
97971
+ }
97972
+ }
97973
+ return message;
97974
+ }
97975
+ internalBinaryWrite(message, writer, options) {
97976
+ if (message.repositoryId !== "0")
97977
+ writer.tag(1, runtime_1.WireType.Varint).int64(message.repositoryId);
97978
+ for (let i = 0;i < message.scope.length; i++)
97979
+ cachescope_1.CacheScope.internalBinaryWrite(message.scope[i], writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
97980
+ let u = options.writeUnknownFields;
97981
+ if (u !== false)
97982
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
97983
+ return writer;
97984
+ }
97985
+ }
97986
+ exports.CacheMetadata = new CacheMetadata$Type;
97987
+ });
97988
+
97989
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/generated/results/api/v1/cache.js
97990
+ var require_cache3 = __commonJS((exports) => {
97991
+ Object.defineProperty(exports, "__esModule", { value: true });
97992
+ exports.CacheService = exports.GetCacheEntryDownloadURLResponse = exports.GetCacheEntryDownloadURLRequest = exports.FinalizeCacheEntryUploadResponse = exports.FinalizeCacheEntryUploadRequest = exports.CreateCacheEntryResponse = exports.CreateCacheEntryRequest = undefined;
97993
+ var runtime_rpc_1 = require_commonjs2();
97994
+ var runtime_1 = require_commonjs();
97995
+ var runtime_2 = require_commonjs();
97996
+ var runtime_3 = require_commonjs();
97997
+ var runtime_4 = require_commonjs();
97998
+ var runtime_5 = require_commonjs();
97999
+ var cachemetadata_1 = require_cachemetadata();
98000
+
98001
+ class CreateCacheEntryRequest$Type extends runtime_5.MessageType {
98002
+ constructor() {
98003
+ super("github.actions.results.api.v1.CreateCacheEntryRequest", [
98004
+ { no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
98005
+ { no: 2, name: "key", kind: "scalar", T: 9 },
98006
+ { no: 3, name: "version", kind: "scalar", T: 9 }
98007
+ ]);
98008
+ }
98009
+ create(value) {
98010
+ const message = { key: "", version: "" };
98011
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
98012
+ if (value !== undefined)
98013
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
98014
+ return message;
98015
+ }
98016
+ internalBinaryRead(reader, length, options, target) {
98017
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
98018
+ while (reader.pos < end) {
98019
+ let [fieldNo, wireType] = reader.tag();
98020
+ switch (fieldNo) {
98021
+ case 1:
98022
+ message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
98023
+ break;
98024
+ case 2:
98025
+ message.key = reader.string();
98026
+ break;
98027
+ case 3:
98028
+ message.version = reader.string();
98029
+ break;
98030
+ default:
98031
+ let u = options.readUnknownField;
98032
+ if (u === "throw")
98033
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
98034
+ let d = reader.skip(wireType);
98035
+ if (u !== false)
98036
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
98037
+ }
98038
+ }
98039
+ return message;
98040
+ }
98041
+ internalBinaryWrite(message, writer, options) {
98042
+ if (message.metadata)
98043
+ cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
98044
+ if (message.key !== "")
98045
+ writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
98046
+ if (message.version !== "")
98047
+ writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.version);
98048
+ let u = options.writeUnknownFields;
98049
+ if (u !== false)
98050
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98051
+ return writer;
98052
+ }
98053
+ }
98054
+ exports.CreateCacheEntryRequest = new CreateCacheEntryRequest$Type;
98055
+
98056
+ class CreateCacheEntryResponse$Type extends runtime_5.MessageType {
98057
+ constructor() {
98058
+ super("github.actions.results.api.v1.CreateCacheEntryResponse", [
98059
+ { no: 1, name: "ok", kind: "scalar", T: 8 },
98060
+ { no: 2, name: "signed_upload_url", kind: "scalar", T: 9 },
98061
+ { no: 3, name: "message", kind: "scalar", T: 9 }
98062
+ ]);
98063
+ }
98064
+ create(value) {
98065
+ const message = { ok: false, signedUploadUrl: "", message: "" };
98066
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
98067
+ if (value !== undefined)
98068
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
98069
+ return message;
98070
+ }
98071
+ internalBinaryRead(reader, length, options, target) {
98072
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
98073
+ while (reader.pos < end) {
98074
+ let [fieldNo, wireType] = reader.tag();
98075
+ switch (fieldNo) {
98076
+ case 1:
98077
+ message.ok = reader.bool();
98078
+ break;
98079
+ case 2:
98080
+ message.signedUploadUrl = reader.string();
98081
+ break;
98082
+ case 3:
98083
+ message.message = reader.string();
98084
+ break;
98085
+ default:
98086
+ let u = options.readUnknownField;
98087
+ if (u === "throw")
98088
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
98089
+ let d = reader.skip(wireType);
98090
+ if (u !== false)
98091
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
98092
+ }
98093
+ }
98094
+ return message;
98095
+ }
98096
+ internalBinaryWrite(message, writer, options) {
98097
+ if (message.ok !== false)
98098
+ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
98099
+ if (message.signedUploadUrl !== "")
98100
+ writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl);
98101
+ if (message.message !== "")
98102
+ writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message);
98103
+ let u = options.writeUnknownFields;
98104
+ if (u !== false)
98105
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98106
+ return writer;
98107
+ }
98108
+ }
98109
+ exports.CreateCacheEntryResponse = new CreateCacheEntryResponse$Type;
98110
+
98111
+ class FinalizeCacheEntryUploadRequest$Type extends runtime_5.MessageType {
98112
+ constructor() {
98113
+ super("github.actions.results.api.v1.FinalizeCacheEntryUploadRequest", [
98114
+ { no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
98115
+ { no: 2, name: "key", kind: "scalar", T: 9 },
98116
+ { no: 3, name: "size_bytes", kind: "scalar", T: 3 },
98117
+ { no: 4, name: "version", kind: "scalar", T: 9 }
98118
+ ]);
98119
+ }
98120
+ create(value) {
98121
+ const message = { key: "", sizeBytes: "0", version: "" };
98122
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
98123
+ if (value !== undefined)
98124
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
98125
+ return message;
98126
+ }
98127
+ internalBinaryRead(reader, length, options, target) {
98128
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
98129
+ while (reader.pos < end) {
98130
+ let [fieldNo, wireType] = reader.tag();
98131
+ switch (fieldNo) {
98132
+ case 1:
98133
+ message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
98134
+ break;
98135
+ case 2:
98136
+ message.key = reader.string();
98137
+ break;
98138
+ case 3:
98139
+ message.sizeBytes = reader.int64().toString();
98140
+ break;
98141
+ case 4:
98142
+ message.version = reader.string();
98143
+ break;
98144
+ default:
98145
+ let u = options.readUnknownField;
98146
+ if (u === "throw")
98147
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
98148
+ let d = reader.skip(wireType);
98149
+ if (u !== false)
98150
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
98151
+ }
98152
+ }
98153
+ return message;
98154
+ }
98155
+ internalBinaryWrite(message, writer, options) {
98156
+ if (message.metadata)
98157
+ cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
98158
+ if (message.key !== "")
98159
+ writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
98160
+ if (message.sizeBytes !== "0")
98161
+ writer.tag(3, runtime_1.WireType.Varint).int64(message.sizeBytes);
98162
+ if (message.version !== "")
98163
+ writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
98164
+ let u = options.writeUnknownFields;
98165
+ if (u !== false)
98166
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98167
+ return writer;
98168
+ }
98169
+ }
98170
+ exports.FinalizeCacheEntryUploadRequest = new FinalizeCacheEntryUploadRequest$Type;
98171
+
98172
+ class FinalizeCacheEntryUploadResponse$Type extends runtime_5.MessageType {
98173
+ constructor() {
98174
+ super("github.actions.results.api.v1.FinalizeCacheEntryUploadResponse", [
98175
+ { no: 1, name: "ok", kind: "scalar", T: 8 },
98176
+ { no: 2, name: "entry_id", kind: "scalar", T: 3 },
98177
+ { no: 3, name: "message", kind: "scalar", T: 9 }
98178
+ ]);
98179
+ }
98180
+ create(value) {
98181
+ const message = { ok: false, entryId: "0", message: "" };
98182
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
98183
+ if (value !== undefined)
98184
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
98185
+ return message;
98186
+ }
98187
+ internalBinaryRead(reader, length, options, target) {
98188
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
98189
+ while (reader.pos < end) {
98190
+ let [fieldNo, wireType] = reader.tag();
98191
+ switch (fieldNo) {
98192
+ case 1:
98193
+ message.ok = reader.bool();
98194
+ break;
98195
+ case 2:
98196
+ message.entryId = reader.int64().toString();
98197
+ break;
98198
+ case 3:
98199
+ message.message = reader.string();
98200
+ break;
98201
+ default:
98202
+ let u = options.readUnknownField;
98203
+ if (u === "throw")
98204
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
98205
+ let d = reader.skip(wireType);
98206
+ if (u !== false)
98207
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
98208
+ }
98209
+ }
98210
+ return message;
98211
+ }
98212
+ internalBinaryWrite(message, writer, options) {
98213
+ if (message.ok !== false)
98214
+ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
98215
+ if (message.entryId !== "0")
98216
+ writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId);
98217
+ if (message.message !== "")
98218
+ writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message);
98219
+ let u = options.writeUnknownFields;
98220
+ if (u !== false)
98221
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98222
+ return writer;
98223
+ }
98224
+ }
98225
+ exports.FinalizeCacheEntryUploadResponse = new FinalizeCacheEntryUploadResponse$Type;
98226
+
98227
+ class GetCacheEntryDownloadURLRequest$Type extends runtime_5.MessageType {
98228
+ constructor() {
98229
+ super("github.actions.results.api.v1.GetCacheEntryDownloadURLRequest", [
98230
+ { no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
98231
+ { no: 2, name: "key", kind: "scalar", T: 9 },
98232
+ { no: 3, name: "restore_keys", kind: "scalar", repeat: 2, T: 9 },
98233
+ { no: 4, name: "version", kind: "scalar", T: 9 }
98234
+ ]);
98235
+ }
98236
+ create(value) {
98237
+ const message = { key: "", restoreKeys: [], version: "" };
98238
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
98239
+ if (value !== undefined)
98240
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
98241
+ return message;
98242
+ }
98243
+ internalBinaryRead(reader, length, options, target) {
98244
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
98245
+ while (reader.pos < end) {
98246
+ let [fieldNo, wireType] = reader.tag();
98247
+ switch (fieldNo) {
98248
+ case 1:
98249
+ message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
98250
+ break;
98251
+ case 2:
98252
+ message.key = reader.string();
98253
+ break;
98254
+ case 3:
98255
+ message.restoreKeys.push(reader.string());
98256
+ break;
98257
+ case 4:
98258
+ message.version = reader.string();
98259
+ break;
98260
+ default:
98261
+ let u = options.readUnknownField;
98262
+ if (u === "throw")
98263
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
98264
+ let d = reader.skip(wireType);
98265
+ if (u !== false)
98266
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
98267
+ }
98268
+ }
98269
+ return message;
98270
+ }
98271
+ internalBinaryWrite(message, writer, options) {
98272
+ if (message.metadata)
98273
+ cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
98274
+ if (message.key !== "")
98275
+ writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
98276
+ for (let i = 0;i < message.restoreKeys.length; i++)
98277
+ writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.restoreKeys[i]);
98278
+ if (message.version !== "")
98279
+ writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
98280
+ let u = options.writeUnknownFields;
98281
+ if (u !== false)
98282
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98283
+ return writer;
98284
+ }
98285
+ }
98286
+ exports.GetCacheEntryDownloadURLRequest = new GetCacheEntryDownloadURLRequest$Type;
98287
+
98288
+ class GetCacheEntryDownloadURLResponse$Type extends runtime_5.MessageType {
98289
+ constructor() {
98290
+ super("github.actions.results.api.v1.GetCacheEntryDownloadURLResponse", [
98291
+ { no: 1, name: "ok", kind: "scalar", T: 8 },
98292
+ { no: 2, name: "signed_download_url", kind: "scalar", T: 9 },
98293
+ { no: 3, name: "matched_key", kind: "scalar", T: 9 }
98294
+ ]);
98295
+ }
98296
+ create(value) {
98297
+ const message = { ok: false, signedDownloadUrl: "", matchedKey: "" };
98298
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
98299
+ if (value !== undefined)
98300
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
98301
+ return message;
98302
+ }
98303
+ internalBinaryRead(reader, length, options, target) {
98304
+ let message = target !== null && target !== undefined ? target : this.create(), end = reader.pos + length;
98305
+ while (reader.pos < end) {
98306
+ let [fieldNo, wireType] = reader.tag();
98307
+ switch (fieldNo) {
98308
+ case 1:
98309
+ message.ok = reader.bool();
98310
+ break;
98311
+ case 2:
98312
+ message.signedDownloadUrl = reader.string();
98313
+ break;
98314
+ case 3:
98315
+ message.matchedKey = reader.string();
98316
+ break;
98317
+ default:
98318
+ let u = options.readUnknownField;
98319
+ if (u === "throw")
98320
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
98321
+ let d = reader.skip(wireType);
98322
+ if (u !== false)
98323
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
98324
+ }
98325
+ }
98326
+ return message;
98327
+ }
98328
+ internalBinaryWrite(message, writer, options) {
98329
+ if (message.ok !== false)
98330
+ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
98331
+ if (message.signedDownloadUrl !== "")
98332
+ writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedDownloadUrl);
98333
+ if (message.matchedKey !== "")
98334
+ writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.matchedKey);
98335
+ let u = options.writeUnknownFields;
98336
+ if (u !== false)
98337
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98338
+ return writer;
98339
+ }
98340
+ }
98341
+ exports.GetCacheEntryDownloadURLResponse = new GetCacheEntryDownloadURLResponse$Type;
98342
+ exports.CacheService = new runtime_rpc_1.ServiceType("github.actions.results.api.v1.CacheService", [
98343
+ { name: "CreateCacheEntry", options: {}, I: exports.CreateCacheEntryRequest, O: exports.CreateCacheEntryResponse },
98344
+ { name: "FinalizeCacheEntryUpload", options: {}, I: exports.FinalizeCacheEntryUploadRequest, O: exports.FinalizeCacheEntryUploadResponse },
98345
+ { name: "GetCacheEntryDownloadURL", options: {}, I: exports.GetCacheEntryDownloadURLRequest, O: exports.GetCacheEntryDownloadURLResponse }
98346
+ ]);
98347
+ });
98348
+
98349
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/generated/results/api/v1/cache.twirp-client.js
98350
+ var require_cache_twirp_client = __commonJS((exports) => {
98351
+ Object.defineProperty(exports, "__esModule", { value: true });
98352
+ exports.CacheServiceClientProtobuf = exports.CacheServiceClientJSON = undefined;
98353
+ var cache_1 = require_cache3();
98354
+
98355
+ class CacheServiceClientJSON {
98356
+ constructor(rpc) {
98357
+ this.rpc = rpc;
98358
+ this.CreateCacheEntry.bind(this);
98359
+ this.FinalizeCacheEntryUpload.bind(this);
98360
+ this.GetCacheEntryDownloadURL.bind(this);
98361
+ }
98362
+ CreateCacheEntry(request) {
98363
+ const data = cache_1.CreateCacheEntryRequest.toJson(request, {
98364
+ useProtoFieldName: true,
98365
+ emitDefaultValues: false
98366
+ });
98367
+ const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "CreateCacheEntry", "application/json", data);
98368
+ return promise.then((data2) => cache_1.CreateCacheEntryResponse.fromJson(data2, {
98369
+ ignoreUnknownFields: true
98370
+ }));
98371
+ }
98372
+ FinalizeCacheEntryUpload(request) {
98373
+ const data = cache_1.FinalizeCacheEntryUploadRequest.toJson(request, {
98374
+ useProtoFieldName: true,
98375
+ emitDefaultValues: false
98376
+ });
98377
+ const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "FinalizeCacheEntryUpload", "application/json", data);
98378
+ return promise.then((data2) => cache_1.FinalizeCacheEntryUploadResponse.fromJson(data2, {
98379
+ ignoreUnknownFields: true
98380
+ }));
98381
+ }
98382
+ GetCacheEntryDownloadURL(request) {
98383
+ const data = cache_1.GetCacheEntryDownloadURLRequest.toJson(request, {
98384
+ useProtoFieldName: true,
98385
+ emitDefaultValues: false
98386
+ });
98387
+ const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "GetCacheEntryDownloadURL", "application/json", data);
98388
+ return promise.then((data2) => cache_1.GetCacheEntryDownloadURLResponse.fromJson(data2, {
98389
+ ignoreUnknownFields: true
98390
+ }));
98391
+ }
98392
+ }
98393
+ exports.CacheServiceClientJSON = CacheServiceClientJSON;
98394
+
98395
+ class CacheServiceClientProtobuf {
98396
+ constructor(rpc) {
98397
+ this.rpc = rpc;
98398
+ this.CreateCacheEntry.bind(this);
98399
+ this.FinalizeCacheEntryUpload.bind(this);
98400
+ this.GetCacheEntryDownloadURL.bind(this);
98401
+ }
98402
+ CreateCacheEntry(request) {
98403
+ const data = cache_1.CreateCacheEntryRequest.toBinary(request);
98404
+ const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "CreateCacheEntry", "application/protobuf", data);
98405
+ return promise.then((data2) => cache_1.CreateCacheEntryResponse.fromBinary(data2));
98406
+ }
98407
+ FinalizeCacheEntryUpload(request) {
98408
+ const data = cache_1.FinalizeCacheEntryUploadRequest.toBinary(request);
98409
+ const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "FinalizeCacheEntryUpload", "application/protobuf", data);
98410
+ return promise.then((data2) => cache_1.FinalizeCacheEntryUploadResponse.fromBinary(data2));
98411
+ }
98412
+ GetCacheEntryDownloadURL(request) {
98413
+ const data = cache_1.GetCacheEntryDownloadURLRequest.toBinary(request);
98414
+ const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "GetCacheEntryDownloadURL", "application/protobuf", data);
98415
+ return promise.then((data2) => cache_1.GetCacheEntryDownloadURLResponse.fromBinary(data2));
98416
+ }
98417
+ }
98418
+ exports.CacheServiceClientProtobuf = CacheServiceClientProtobuf;
98419
+ });
98420
+
98421
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/shared/util.js
98422
+ var require_util14 = __commonJS((exports) => {
98423
+ Object.defineProperty(exports, "__esModule", { value: true });
98424
+ exports.maskSecretUrls = exports.maskSigUrl = undefined;
98425
+ var core_1 = require_core();
98426
+ function maskSigUrl(url) {
98427
+ if (!url)
98428
+ return;
98429
+ try {
98430
+ const parsedUrl = new URL(url);
98431
+ const signature = parsedUrl.searchParams.get("sig");
98432
+ if (signature) {
98433
+ (0, core_1.setSecret)(signature);
98434
+ (0, core_1.setSecret)(encodeURIComponent(signature));
98435
+ }
98436
+ } catch (error2) {
98437
+ (0, core_1.debug)(`Failed to parse URL: ${url} ${error2 instanceof Error ? error2.message : String(error2)}`);
98438
+ }
98439
+ }
98440
+ exports.maskSigUrl = maskSigUrl;
98441
+ function maskSecretUrls(body) {
98442
+ if (typeof body !== "object" || body === null) {
98443
+ (0, core_1.debug)("body is not an object or is null");
98444
+ return;
98445
+ }
98446
+ if ("signed_upload_url" in body && typeof body.signed_upload_url === "string") {
98447
+ maskSigUrl(body.signed_upload_url);
98448
+ }
98449
+ if ("signed_download_url" in body && typeof body.signed_download_url === "string") {
98450
+ maskSigUrl(body.signed_download_url);
98451
+ }
98452
+ }
98453
+ exports.maskSecretUrls = maskSecretUrls;
98454
+ });
98455
+
98456
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/shared/cacheTwirpClient.js
98457
+ var require_cacheTwirpClient = __commonJS((exports) => {
98458
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
98459
+ function adopt(value) {
98460
+ return value instanceof P ? value : new P(function(resolve) {
98461
+ resolve(value);
98462
+ });
98463
+ }
98464
+ return new (P || (P = Promise))(function(resolve, reject) {
98465
+ function fulfilled(value) {
98466
+ try {
98467
+ step(generator.next(value));
98468
+ } catch (e) {
98469
+ reject(e);
98470
+ }
98471
+ }
98472
+ function rejected(value) {
98473
+ try {
98474
+ step(generator["throw"](value));
98475
+ } catch (e) {
98476
+ reject(e);
98477
+ }
98478
+ }
98479
+ function step(result) {
98480
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
98481
+ }
98482
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
98483
+ });
98484
+ };
98485
+ Object.defineProperty(exports, "__esModule", { value: true });
98486
+ exports.internalCacheTwirpClient = undefined;
98487
+ var core_1 = require_core();
98488
+ var user_agent_1 = require_user_agent2();
98489
+ var errors_1 = require_errors4();
98490
+ var config_1 = require_config2();
98491
+ var cacheUtils_1 = require_cacheUtils();
98492
+ var auth_1 = require_auth();
98493
+ var http_client_1 = require_lib();
98494
+ var cache_twirp_client_1 = require_cache_twirp_client();
98495
+ var util_1 = require_util14();
98496
+
98497
+ class CacheServiceClient {
98498
+ constructor(userAgent, maxAttempts, baseRetryIntervalMilliseconds, retryMultiplier) {
98499
+ this.maxAttempts = 5;
98500
+ this.baseRetryIntervalMilliseconds = 3000;
98501
+ this.retryMultiplier = 1.5;
98502
+ const token = (0, cacheUtils_1.getRuntimeToken)();
98503
+ this.baseUrl = (0, config_1.getCacheServiceURL)();
98504
+ if (maxAttempts) {
98505
+ this.maxAttempts = maxAttempts;
98506
+ }
98507
+ if (baseRetryIntervalMilliseconds) {
98508
+ this.baseRetryIntervalMilliseconds = baseRetryIntervalMilliseconds;
98509
+ }
98510
+ if (retryMultiplier) {
98511
+ this.retryMultiplier = retryMultiplier;
98512
+ }
98513
+ this.httpClient = new http_client_1.HttpClient(userAgent, [
98514
+ new auth_1.BearerCredentialHandler(token)
98515
+ ]);
98516
+ }
98517
+ request(service, method, contentType, data) {
98518
+ return __awaiter(this, undefined, undefined, function* () {
98519
+ const url = new URL(`/twirp/${service}/${method}`, this.baseUrl).href;
98520
+ (0, core_1.debug)(`[Request] ${method} ${url}`);
98521
+ const headers = {
98522
+ "Content-Type": contentType
98523
+ };
98524
+ try {
98525
+ const { body } = yield this.retryableRequest(() => __awaiter(this, undefined, undefined, function* () {
98526
+ return this.httpClient.post(url, JSON.stringify(data), headers);
98527
+ }));
98528
+ return body;
98529
+ } catch (error2) {
98530
+ throw new Error(`Failed to ${method}: ${error2.message}`);
98531
+ }
98532
+ });
98533
+ }
98534
+ retryableRequest(operation) {
98535
+ return __awaiter(this, undefined, undefined, function* () {
98536
+ let attempt = 0;
98537
+ let errorMessage = "";
98538
+ let rawBody = "";
98539
+ while (attempt < this.maxAttempts) {
98540
+ let isRetryable = false;
98541
+ try {
98542
+ const response = yield operation();
98543
+ const statusCode = response.message.statusCode;
98544
+ rawBody = yield response.readBody();
98545
+ (0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
98546
+ (0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
98547
+ const body = JSON.parse(rawBody);
98548
+ (0, util_1.maskSecretUrls)(body);
98549
+ (0, core_1.debug)(`Body: ${JSON.stringify(body, null, 2)}`);
98550
+ if (this.isSuccessStatusCode(statusCode)) {
98551
+ return { response, body };
98552
+ }
98553
+ isRetryable = this.isRetryableHttpStatusCode(statusCode);
98554
+ errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`;
98555
+ if (body.msg) {
98556
+ if (errors_1.UsageError.isUsageErrorMessage(body.msg)) {
98557
+ throw new errors_1.UsageError;
98558
+ }
98559
+ errorMessage = `${errorMessage}: ${body.msg}`;
98560
+ }
98561
+ } catch (error2) {
98562
+ if (error2 instanceof SyntaxError) {
98563
+ (0, core_1.debug)(`Raw Body: ${rawBody}`);
98564
+ }
98565
+ if (error2 instanceof errors_1.UsageError) {
98566
+ throw error2;
98567
+ }
98568
+ if (errors_1.NetworkError.isNetworkErrorCode(error2 === null || error2 === undefined ? undefined : error2.code)) {
98569
+ throw new errors_1.NetworkError(error2 === null || error2 === undefined ? undefined : error2.code);
98570
+ }
98571
+ isRetryable = true;
98572
+ errorMessage = error2.message;
98573
+ }
98574
+ if (!isRetryable) {
98575
+ throw new Error(`Received non-retryable error: ${errorMessage}`);
98576
+ }
98577
+ if (attempt + 1 === this.maxAttempts) {
98578
+ throw new Error(`Failed to make request after ${this.maxAttempts} attempts: ${errorMessage}`);
98579
+ }
98580
+ const retryTimeMilliseconds = this.getExponentialRetryTimeMilliseconds(attempt);
98581
+ (0, core_1.info)(`Attempt ${attempt + 1} of ${this.maxAttempts} failed with error: ${errorMessage}. Retrying request in ${retryTimeMilliseconds} ms...`);
98582
+ yield this.sleep(retryTimeMilliseconds);
98583
+ attempt++;
98584
+ }
98585
+ throw new Error(`Request failed`);
98586
+ });
98587
+ }
98588
+ isSuccessStatusCode(statusCode) {
98589
+ if (!statusCode)
98590
+ return false;
98591
+ return statusCode >= 200 && statusCode < 300;
98592
+ }
98593
+ isRetryableHttpStatusCode(statusCode) {
98594
+ if (!statusCode)
98595
+ return false;
98596
+ const retryableStatusCodes = [
98597
+ http_client_1.HttpCodes.BadGateway,
98598
+ http_client_1.HttpCodes.GatewayTimeout,
98599
+ http_client_1.HttpCodes.InternalServerError,
98600
+ http_client_1.HttpCodes.ServiceUnavailable,
98601
+ http_client_1.HttpCodes.TooManyRequests
98602
+ ];
98603
+ return retryableStatusCodes.includes(statusCode);
98604
+ }
98605
+ sleep(milliseconds) {
98606
+ return __awaiter(this, undefined, undefined, function* () {
98607
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
98608
+ });
98609
+ }
98610
+ getExponentialRetryTimeMilliseconds(attempt) {
98611
+ if (attempt < 0) {
98612
+ throw new Error("attempt should be a positive integer");
97485
98613
  }
97486
- return;
97487
- });
97488
- }
97489
- function commitCache(httpClient, cacheId, filesize) {
97490
- return __awaiter(this, undefined, undefined, function* () {
97491
- const commitCacheRequest = { size: filesize };
97492
- return yield (0, requestUtils_1.retryTypedResponse)("commitCache", () => __awaiter(this, undefined, undefined, function* () {
97493
- return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
97494
- }));
97495
- });
98614
+ if (attempt === 0) {
98615
+ return this.baseRetryIntervalMilliseconds;
98616
+ }
98617
+ const minTime = this.baseRetryIntervalMilliseconds * Math.pow(this.retryMultiplier, attempt);
98618
+ const maxTime = minTime * this.retryMultiplier;
98619
+ return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
98620
+ }
97496
98621
  }
97497
- function saveCache(cacheId, archivePath, options) {
97498
- return __awaiter(this, undefined, undefined, function* () {
97499
- const httpClient = createHttpClient();
97500
- core2.debug("Upload cache");
97501
- yield uploadFile(httpClient, cacheId, archivePath, options);
97502
- core2.debug("Commiting cache");
97503
- const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
97504
- core2.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
97505
- const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
97506
- if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) {
97507
- throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
97508
- }
97509
- core2.info("Cache saved successfully");
97510
- });
98622
+ function internalCacheTwirpClient(options) {
98623
+ const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === undefined ? undefined : options.maxAttempts, options === null || options === undefined ? undefined : options.retryIntervalMs, options === null || options === undefined ? undefined : options.retryMultiplier);
98624
+ return new cache_twirp_client_1.CacheServiceClientJSON(client);
97511
98625
  }
97512
- exports.saveCache = saveCache;
98626
+ exports.internalCacheTwirpClient = internalCacheTwirpClient;
97513
98627
  });
97514
98628
 
97515
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/internal/tar.js
98629
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/internal/tar.js
97516
98630
  var require_tar2 = __commonJS((exports) => {
97517
98631
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
97518
98632
  if (k2 === undefined)
@@ -97758,8 +98872,8 @@ var require_tar2 = __commonJS((exports) => {
97758
98872
  exports.createTar = createTar;
97759
98873
  });
97760
98874
 
97761
- // ../../node_modules/.bun/@actions+cache@3.3.0/node_modules/@actions/cache/lib/cache.js
97762
- var require_cache3 = __commonJS((exports) => {
98875
+ // ../../node_modules/.bun/@actions+cache@4.1.0/node_modules/@actions/cache/lib/cache.js
98876
+ var require_cache4 = __commonJS((exports) => {
97763
98877
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
97764
98878
  if (k2 === undefined)
97765
98879
  k2 = k;
@@ -97820,12 +98934,15 @@ var require_cache3 = __commonJS((exports) => {
97820
98934
  });
97821
98935
  };
97822
98936
  Object.defineProperty(exports, "__esModule", { value: true });
97823
- exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.ReserveCacheError = exports.ValidationError = undefined;
98937
+ exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.FinalizeCacheError = exports.ReserveCacheError = exports.ValidationError = undefined;
97824
98938
  var core2 = __importStar(require_core());
97825
98939
  var path = __importStar(__require("path"));
97826
98940
  var utils = __importStar(require_cacheUtils());
97827
98941
  var cacheHttpClient = __importStar(require_cacheHttpClient());
98942
+ var cacheTwirpClient = __importStar(require_cacheTwirpClient());
98943
+ var config_1 = require_config2();
97828
98944
  var tar_1 = require_tar2();
98945
+ var http_client_1 = require_lib();
97829
98946
 
97830
98947
  class ValidationError extends Error {
97831
98948
  constructor(message) {
@@ -97844,6 +98961,15 @@ var require_cache3 = __commonJS((exports) => {
97844
98961
  }
97845
98962
  }
97846
98963
  exports.ReserveCacheError = ReserveCacheError;
98964
+
98965
+ class FinalizeCacheError extends Error {
98966
+ constructor(message) {
98967
+ super(message);
98968
+ this.name = "FinalizeCacheError";
98969
+ Object.setPrototypeOf(this, FinalizeCacheError.prototype);
98970
+ }
98971
+ }
98972
+ exports.FinalizeCacheError = FinalizeCacheError;
97847
98973
  function checkPaths(paths) {
97848
98974
  if (!paths || paths.length === 0) {
97849
98975
  throw new ValidationError(`Path Validation Error: At least one directory or file path is required`);
@@ -97859,12 +98985,33 @@ var require_cache3 = __commonJS((exports) => {
97859
98985
  }
97860
98986
  }
97861
98987
  function isFeatureAvailable() {
97862
- return !!process.env["ACTIONS_CACHE_URL"];
98988
+ const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
98989
+ switch (cacheServiceVersion) {
98990
+ case "v2":
98991
+ return !!process.env["ACTIONS_RESULTS_URL"];
98992
+ case "v1":
98993
+ default:
98994
+ return !!process.env["ACTIONS_CACHE_URL"];
98995
+ }
97863
98996
  }
97864
98997
  exports.isFeatureAvailable = isFeatureAvailable;
97865
98998
  function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
97866
98999
  return __awaiter(this, undefined, undefined, function* () {
99000
+ const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
99001
+ core2.debug(`Cache service version: ${cacheServiceVersion}`);
97867
99002
  checkPaths(paths);
99003
+ switch (cacheServiceVersion) {
99004
+ case "v2":
99005
+ return yield restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
99006
+ case "v1":
99007
+ default:
99008
+ return yield restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
99009
+ }
99010
+ });
99011
+ }
99012
+ exports.restoreCache = restoreCache;
99013
+ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
99014
+ return __awaiter(this, undefined, undefined, function* () {
97868
99015
  restoreKeys = restoreKeys || [];
97869
99016
  const keys = [primaryKey, ...restoreKeys];
97870
99017
  core2.debug("Resolved Keys:");
@@ -97905,7 +99052,11 @@ var require_cache3 = __commonJS((exports) => {
97905
99052
  if (typedError.name === ValidationError.name) {
97906
99053
  throw error2;
97907
99054
  } else {
97908
- core2.warning(`Failed to restore: ${error2.message}`);
99055
+ if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
99056
+ core2.error(`Failed to restore: ${error2.message}`);
99057
+ } else {
99058
+ core2.warning(`Failed to restore: ${error2.message}`);
99059
+ }
97909
99060
  }
97910
99061
  } finally {
97911
99062
  try {
@@ -97917,12 +99068,97 @@ var require_cache3 = __commonJS((exports) => {
97917
99068
  return;
97918
99069
  });
97919
99070
  }
97920
- exports.restoreCache = restoreCache;
99071
+ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
99072
+ return __awaiter(this, undefined, undefined, function* () {
99073
+ options = Object.assign(Object.assign({}, options), { useAzureSdk: true });
99074
+ restoreKeys = restoreKeys || [];
99075
+ const keys = [primaryKey, ...restoreKeys];
99076
+ core2.debug("Resolved Keys:");
99077
+ core2.debug(JSON.stringify(keys));
99078
+ if (keys.length > 10) {
99079
+ throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
99080
+ }
99081
+ for (const key of keys) {
99082
+ checkKey(key);
99083
+ }
99084
+ let archivePath = "";
99085
+ try {
99086
+ const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
99087
+ const compressionMethod = yield utils.getCompressionMethod();
99088
+ const request = {
99089
+ key: primaryKey,
99090
+ restoreKeys,
99091
+ version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
99092
+ };
99093
+ const response = yield twirpClient.GetCacheEntryDownloadURL(request);
99094
+ if (!response.ok) {
99095
+ core2.debug(`Cache not found for version ${request.version} of keys: ${keys.join(", ")}`);
99096
+ return;
99097
+ }
99098
+ const isRestoreKeyMatch = request.key !== response.matchedKey;
99099
+ if (isRestoreKeyMatch) {
99100
+ core2.info(`Cache hit for restore-key: ${response.matchedKey}`);
99101
+ } else {
99102
+ core2.info(`Cache hit for: ${response.matchedKey}`);
99103
+ }
99104
+ if (options === null || options === undefined ? undefined : options.lookupOnly) {
99105
+ core2.info("Lookup only - skipping download");
99106
+ return response.matchedKey;
99107
+ }
99108
+ archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
99109
+ core2.debug(`Archive path: ${archivePath}`);
99110
+ core2.debug(`Starting download of archive to: ${archivePath}`);
99111
+ yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options);
99112
+ const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
99113
+ core2.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
99114
+ if (core2.isDebug()) {
99115
+ yield (0, tar_1.listTar)(archivePath, compressionMethod);
99116
+ }
99117
+ yield (0, tar_1.extractTar)(archivePath, compressionMethod);
99118
+ core2.info("Cache restored successfully");
99119
+ return response.matchedKey;
99120
+ } catch (error2) {
99121
+ const typedError = error2;
99122
+ if (typedError.name === ValidationError.name) {
99123
+ throw error2;
99124
+ } else {
99125
+ if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
99126
+ core2.error(`Failed to restore: ${error2.message}`);
99127
+ } else {
99128
+ core2.warning(`Failed to restore: ${error2.message}`);
99129
+ }
99130
+ }
99131
+ } finally {
99132
+ try {
99133
+ if (archivePath) {
99134
+ yield utils.unlinkFile(archivePath);
99135
+ }
99136
+ } catch (error2) {
99137
+ core2.debug(`Failed to delete archive: ${error2}`);
99138
+ }
99139
+ }
99140
+ return;
99141
+ });
99142
+ }
97921
99143
  function saveCache(paths, key, options, enableCrossOsArchive = false) {
97922
- var _a, _b, _c, _d, _e;
97923
99144
  return __awaiter(this, undefined, undefined, function* () {
99145
+ const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
99146
+ core2.debug(`Cache service version: ${cacheServiceVersion}`);
97924
99147
  checkPaths(paths);
97925
99148
  checkKey(key);
99149
+ switch (cacheServiceVersion) {
99150
+ case "v2":
99151
+ return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
99152
+ case "v1":
99153
+ default:
99154
+ return yield saveCacheV1(paths, key, options, enableCrossOsArchive);
99155
+ }
99156
+ });
99157
+ }
99158
+ exports.saveCache = saveCache;
99159
+ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
99160
+ var _a, _b, _c, _d, _e;
99161
+ return __awaiter(this, undefined, undefined, function* () {
97926
99162
  const compressionMethod = yield utils.getCompressionMethod();
97927
99163
  let cacheId = -1;
97928
99164
  const cachePaths = yield utils.resolvePaths(paths);
@@ -97942,7 +99178,7 @@ var require_cache3 = __commonJS((exports) => {
97942
99178
  const fileSizeLimit = 10 * 1024 * 1024 * 1024;
97943
99179
  const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
97944
99180
  core2.debug(`File Size: ${archiveFileSize}`);
97945
- if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
99181
+ if (archiveFileSize > fileSizeLimit && !(0, config_1.isGhes)()) {
97946
99182
  throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
97947
99183
  }
97948
99184
  core2.debug("Reserving Cache");
@@ -97959,7 +99195,7 @@ var require_cache3 = __commonJS((exports) => {
97959
99195
  throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === undefined ? undefined : reserveCacheResponse.error) === null || _e === undefined ? undefined : _e.message}`);
97960
99196
  }
97961
99197
  core2.debug(`Saving Cache (ID: ${cacheId})`);
97962
- yield cacheHttpClient.saveCache(cacheId, archivePath, options);
99198
+ yield cacheHttpClient.saveCache(cacheId, archivePath, "", options);
97963
99199
  } catch (error2) {
97964
99200
  const typedError = error2;
97965
99201
  if (typedError.name === ValidationError.name) {
@@ -97967,7 +99203,95 @@ var require_cache3 = __commonJS((exports) => {
97967
99203
  } else if (typedError.name === ReserveCacheError.name) {
97968
99204
  core2.info(`Failed to save: ${typedError.message}`);
97969
99205
  } else {
97970
- core2.warning(`Failed to save: ${typedError.message}`);
99206
+ if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
99207
+ core2.error(`Failed to save: ${typedError.message}`);
99208
+ } else {
99209
+ core2.warning(`Failed to save: ${typedError.message}`);
99210
+ }
99211
+ }
99212
+ } finally {
99213
+ try {
99214
+ yield utils.unlinkFile(archivePath);
99215
+ } catch (error2) {
99216
+ core2.debug(`Failed to delete archive: ${error2}`);
99217
+ }
99218
+ }
99219
+ return cacheId;
99220
+ });
99221
+ }
99222
+ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
99223
+ return __awaiter(this, undefined, undefined, function* () {
99224
+ options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
99225
+ const compressionMethod = yield utils.getCompressionMethod();
99226
+ const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
99227
+ let cacheId = -1;
99228
+ const cachePaths = yield utils.resolvePaths(paths);
99229
+ core2.debug("Cache Paths:");
99230
+ core2.debug(`${JSON.stringify(cachePaths)}`);
99231
+ if (cachePaths.length === 0) {
99232
+ throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
99233
+ }
99234
+ const archiveFolder = yield utils.createTempDirectory();
99235
+ const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
99236
+ core2.debug(`Archive Path: ${archivePath}`);
99237
+ try {
99238
+ yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod);
99239
+ if (core2.isDebug()) {
99240
+ yield (0, tar_1.listTar)(archivePath, compressionMethod);
99241
+ }
99242
+ const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
99243
+ core2.debug(`File Size: ${archiveFileSize}`);
99244
+ options.archiveSizeBytes = archiveFileSize;
99245
+ core2.debug("Reserving Cache");
99246
+ const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive);
99247
+ const request = {
99248
+ key,
99249
+ version
99250
+ };
99251
+ let signedUploadUrl;
99252
+ try {
99253
+ const response = yield twirpClient.CreateCacheEntry(request);
99254
+ if (!response.ok) {
99255
+ if (response.message) {
99256
+ core2.warning(`Cache reservation failed: ${response.message}`);
99257
+ }
99258
+ throw new Error(response.message || "Response was not ok");
99259
+ }
99260
+ signedUploadUrl = response.signedUploadUrl;
99261
+ } catch (error2) {
99262
+ core2.debug(`Failed to reserve cache: ${error2}`);
99263
+ throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
99264
+ }
99265
+ core2.debug(`Attempting to upload cache located at: ${archivePath}`);
99266
+ yield cacheHttpClient.saveCache(cacheId, archivePath, signedUploadUrl, options);
99267
+ const finalizeRequest = {
99268
+ key,
99269
+ version,
99270
+ sizeBytes: `${archiveFileSize}`
99271
+ };
99272
+ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
99273
+ core2.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`);
99274
+ if (!finalizeResponse.ok) {
99275
+ if (finalizeResponse.message) {
99276
+ throw new FinalizeCacheError(finalizeResponse.message);
99277
+ }
99278
+ throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`);
99279
+ }
99280
+ cacheId = parseInt(finalizeResponse.entryId);
99281
+ } catch (error2) {
99282
+ const typedError = error2;
99283
+ if (typedError.name === ValidationError.name) {
99284
+ throw error2;
99285
+ } else if (typedError.name === ReserveCacheError.name) {
99286
+ core2.info(`Failed to save: ${typedError.message}`);
99287
+ } else if (typedError.name === FinalizeCacheError.name) {
99288
+ core2.warning(typedError.message);
99289
+ } else {
99290
+ if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
99291
+ core2.error(`Failed to save: ${typedError.message}`);
99292
+ } else {
99293
+ core2.warning(`Failed to save: ${typedError.message}`);
99294
+ }
97971
99295
  }
97972
99296
  } finally {
97973
99297
  try {
@@ -97979,11 +99303,10 @@ var require_cache3 = __commonJS((exports) => {
97979
99303
  return cacheId;
97980
99304
  });
97981
99305
  }
97982
- exports.saveCache = saveCache;
97983
99306
  });
97984
99307
 
97985
99308
  // ../../node_modules/.bun/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/util.js
97986
- var require_util14 = __commonJS((exports) => {
99309
+ var require_util15 = __commonJS((exports) => {
97987
99310
  var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
97988
99311
  var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
97989
99312
  var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
@@ -98040,7 +99363,7 @@ var require_util14 = __commonJS((exports) => {
98040
99363
 
98041
99364
  // ../../node_modules/.bun/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/validator.js
98042
99365
  var require_validator = __commonJS((exports) => {
98043
- var util = require_util14();
99366
+ var util = require_util15();
98044
99367
  var defaultOptions = {
98045
99368
  allowBooleanAttributes: false,
98046
99369
  unpairedTags: []
@@ -98418,7 +99741,7 @@ var require_xmlNode = __commonJS((exports, module) => {
98418
99741
 
98419
99742
  // ../../node_modules/.bun/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
98420
99743
  var require_DocTypeReader = __commonJS((exports, module) => {
98421
- var util = require_util14();
99744
+ var util = require_util15();
98422
99745
  function readDocType(xmlData, i) {
98423
99746
  const entities = {};
98424
99747
  if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
@@ -98651,7 +99974,7 @@ var require_ignoreAttributes = __commonJS((exports, module) => {
98651
99974
 
98652
99975
  // ../../node_modules/.bun/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
98653
99976
  var require_OrderedObjParser = __commonJS((exports, module) => {
98654
- var util = require_util14();
99977
+ var util = require_util15();
98655
99978
  var xmlNode = require_xmlNode();
98656
99979
  var readDocType = require_DocTypeReader();
98657
99980
  var toNumber = require_strnum();
@@ -101191,34 +102514,68 @@ class GitHubArtifactCapability {
101191
102514
  }
101192
102515
 
101193
102516
  // src/capabilities/cache.ts
101194
- var cache = __toESM(require_cache3(), 1);
102517
+ var cache = __toESM(require_cache4(), 1);
101195
102518
  var core2 = __toESM(require_core(), 1);
101196
102519
  var glob2 = __toESM(require_glob2(), 1);
101197
- import { readFile } from "node:fs/promises";
101198
102520
  import { createHash } from "node:crypto";
102521
+ import { mkdir, readFile } from "node:fs/promises";
102522
+ var SAFE_CACHE_NAME = /^[A-Za-z0-9._-]+$/;
102523
+ var MAX_CACHE_KEY_LENGTH = 512;
102524
+ var CACHE_KEY_HASH_LENGTH = 16;
102525
+ function keyHashFragment(value) {
102526
+ return createHash("sha256").update(value).digest("hex").slice(0, CACHE_KEY_HASH_LENGTH);
102527
+ }
102528
+ function trimKeyWithHash(key, maxLength = MAX_CACHE_KEY_LENGTH) {
102529
+ if (key.length <= maxLength)
102530
+ return key;
102531
+ const suffix = `-${keyHashFragment(key)}`;
102532
+ const headLength = Math.max(1, maxLength - suffix.length);
102533
+ return `${key.slice(0, headLength)}${suffix}`;
102534
+ }
102535
+ function normalizeCacheName(name) {
102536
+ if (SAFE_CACHE_NAME.test(name))
102537
+ return name;
102538
+ const normalized = name.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
102539
+ return normalized || "cache";
102540
+ }
101199
102541
 
101200
102542
  class GitHubCacheCapability {
101201
102543
  pendingCaches = [];
101202
102544
  async mount(ref) {
101203
- const path = ref.mountPath;
102545
+ const path = ref.mountPath?.trim();
101204
102546
  if (!path) {
101205
102547
  throw new Error(`Cache "${ref.name}" has no mount path`);
101206
102548
  }
101207
- const key = await this.computeKey(ref);
101208
- const restoreKeys = this.computeRestoreKeys(ref);
101209
- const restoredKey = await cache.restoreCache([path], key, restoreKeys);
102549
+ const normalizedName = normalizeCacheName(ref.name);
102550
+ const key = await this.computeKey(ref, normalizedName);
102551
+ const restoreKeys = this.computeRestoreKeys(normalizedName);
102552
+ await mkdir(path, { recursive: true });
102553
+ let restoredKey;
102554
+ try {
102555
+ restoredKey = await cache.restoreCache([path], key, restoreKeys);
102556
+ } catch (error2) {
102557
+ core2.warning(`Cache restore skipped for "${normalizedName}" (${key}): ${this.formatError(error2)}`);
102558
+ return false;
102559
+ }
101210
102560
  const hit = restoredKey !== undefined;
101211
102561
  if (hit) {
101212
102562
  core2.info(`Cache hit: ${restoredKey}`);
101213
102563
  } else {
101214
102564
  core2.info(`Cache miss, will save as: ${key}`);
101215
102565
  }
102566
+ this.trackPendingCache(path, key, restoredKey);
102567
+ return hit;
102568
+ }
102569
+ trackPendingCache(path, key, restoredKey) {
102570
+ if (!path || !key) {
102571
+ core2.warning("Skipping cache save registration because path or key is empty");
102572
+ return;
102573
+ }
101216
102574
  this.pendingCaches.push({ paths: [path], key, restoredKey });
101217
102575
  process.env.KITSI_PENDING_CACHES = JSON.stringify(this.pendingCaches);
101218
- return hit;
101219
102576
  }
101220
- async computeKey(ref) {
101221
- const parts = [process.env.RUNNER_OS ?? "unknown", ref.name];
102577
+ async computeKey(ref, normalizedName) {
102578
+ const parts = [process.env.RUNNER_OS ?? "unknown", normalizedName];
101222
102579
  const key = ref.key;
101223
102580
  if (key?.files && key.files.length > 0) {
101224
102581
  const hash = await this.hashFiles(key.files);
@@ -101232,7 +102589,7 @@ class GitHubCacheCapability {
101232
102589
  const hash = this.hashValue(key.value);
101233
102590
  parts.push(hash.slice(0, 16));
101234
102591
  }
101235
- return parts.join("-");
102592
+ return trimKeyWithHash(parts.join("-"));
101236
102593
  }
101237
102594
  async hashFiles(patterns) {
101238
102595
  const globber = await glob2.create(patterns.join(`
@@ -101258,8 +102615,16 @@ class GitHubCacheCapability {
101258
102615
  hashValue(value) {
101259
102616
  return createHash("sha256").update(value).digest("hex");
101260
102617
  }
101261
- computeRestoreKeys(ref) {
101262
- return [`${process.env.RUNNER_OS ?? "unknown"}-${ref.name}-`];
102618
+ computeRestoreKeys(normalizedName) {
102619
+ const prefixBase = `${process.env.RUNNER_OS ?? "unknown"}-${normalizedName}`;
102620
+ const prefix = `${trimKeyWithHash(prefixBase, MAX_CACHE_KEY_LENGTH - 1)}-`;
102621
+ return [prefix];
102622
+ }
102623
+ formatError(error2) {
102624
+ if (error2 instanceof Error) {
102625
+ return error2.message;
102626
+ }
102627
+ return String(error2);
101263
102628
  }
101264
102629
  getPendingCaches() {
101265
102630
  return this.pendingCaches;
@@ -102768,7 +104133,7 @@ import { join as join4 } from "node:path";
102768
104133
 
102769
104134
  // ../core/dist/engine/executor/file-system.js
102770
104135
  var import_picomatch2 = __toESM(require_picomatch2(), 1);
102771
- import { mkdir, readFile as readFile3, readdir, stat, writeFile } from "node:fs/promises";
104136
+ import { mkdir as mkdir2, readFile as readFile3, readdir, stat, writeFile } from "node:fs/promises";
102772
104137
  import { dirname, join, relative } from "node:path";
102773
104138
  var walk = async (current) => {
102774
104139
  const entries = await readdir(current);
@@ -102809,7 +104174,7 @@ var collectFiles = async (workspace, patterns) => {
102809
104174
  var writeFiles = async (basePath, files) => {
102810
104175
  await Promise.all(Object.entries(files).map(async ([relativePath, contents]) => {
102811
104176
  const destination = join(basePath, relativePath);
102812
- await mkdir(dirname(destination), { recursive: true });
104177
+ await mkdir2(dirname(destination), { recursive: true });
102813
104178
  await writeFile(destination, contents);
102814
104179
  }));
102815
104180
  };
@@ -103031,7 +104396,7 @@ var inferOutputsFromCommand = (command) => {
103031
104396
 
103032
104397
  // ../core/dist/engine/cache/store.js
103033
104398
  import { existsSync } from "node:fs";
103034
- import { mkdir as mkdir2, readFile as readFile5, readdir as readdir2, rm, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
104399
+ import { mkdir as mkdir3, readFile as readFile5, readdir as readdir2, rm, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
103035
104400
  import { join as join3 } from "node:path";
103036
104401
  var readFileMap = async (basePath) => {
103037
104402
  if (!existsSync(basePath))
@@ -103104,7 +104469,7 @@ class CacheStore {
103104
104469
  const entryPath = this.taskPath(taskName, key);
103105
104470
  if (existsSync(entryPath))
103106
104471
  return;
103107
- await mkdir2(entryPath, { recursive: true });
104472
+ await mkdir3(entryPath, { recursive: true });
103108
104473
  for (const [name, bundle] of data.bundles.entries()) {
103109
104474
  const bundlePath = join3(entryPath, "bundles", name);
103110
104475
  await writeFiles(bundlePath, bundle.files);
@@ -103150,7 +104515,7 @@ class CacheStore {
103150
104515
  const entryPath = this.opPath(key);
103151
104516
  if (existsSync(entryPath))
103152
104517
  return;
103153
- await mkdir2(entryPath, { recursive: true });
104518
+ await mkdir3(entryPath, { recursive: true });
103154
104519
  if (Object.keys(data.files).length > 0) {
103155
104520
  await writeFiles(join3(entryPath, "files"), data.files);
103156
104521
  }
@@ -103985,7 +105350,7 @@ class AnnotateHandler {
103985
105350
 
103986
105351
  // ../core/dist/engine/handlers/artifact-download-handler.js
103987
105352
  import { existsSync as existsSync2 } from "node:fs";
103988
- import { mkdir as mkdir3, readFile as readFile6 } from "node:fs/promises";
105353
+ import { mkdir as mkdir4, readFile as readFile6 } from "node:fs/promises";
103989
105354
  import { join as join5, relative as relative3 } from "node:path";
103990
105355
  class ArtifactDownloadHandler {
103991
105356
  kind = "artifact-download";
@@ -104003,7 +105368,7 @@ class ArtifactDownloadHandler {
104003
105368
  fileMap[relativePath] = await readFile6(file);
104004
105369
  }));
104005
105370
  const destinationBase = join5(context.workspace, op.destination);
104006
- await mkdir3(destinationBase, { recursive: true });
105371
+ await mkdir4(destinationBase, { recursive: true });
104007
105372
  await writeFiles(destinationBase, fileMap);
104008
105373
  context.reporter?.emit("artifact_download_end", {
104009
105374
  artifact: op.name,
@@ -104055,7 +105420,7 @@ class BindServiceHandler {
104055
105420
 
104056
105421
  // ../core/dist/engine/handlers/cache-mount-handler.js
104057
105422
  import { existsSync as existsSync3 } from "node:fs";
104058
- import { mkdir as mkdir4 } from "node:fs/promises";
105423
+ import { mkdir as mkdir5 } from "node:fs/promises";
104059
105424
  import { join as join7 } from "node:path";
104060
105425
 
104061
105426
  class CacheMountHandler {
@@ -104067,7 +105432,7 @@ class CacheMountHandler {
104067
105432
  cache: op.cache.name,
104068
105433
  path: mountPath
104069
105434
  });
104070
- await mkdir4(mountPath, { recursive: true });
105435
+ await mkdir5(mountPath, { recursive: true });
104071
105436
  }
104072
105437
  }
104073
105438