@@ -2005,7 +2005,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20052005 return (mod && mod.__esModule) ? mod : { "default": mod };
20062006};
20072007Object.defineProperty(exports, "__esModule", ({ value: true }));
2008- exports.downloadArtifactInternal = exports.downloadArtifactPublic = void 0;
2008+ exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0;
20092009const promises_1 = __importDefault(__nccwpck_require__(73292));
20102010const github = __importStar(__nccwpck_require__(95438));
20112011const core = __importStar(__nccwpck_require__(42186));
@@ -2039,20 +2039,57 @@ function exists(path) {
20392039 });
20402040}
20412041function streamExtract(url, directory) {
2042+ return __awaiter(this, void 0, void 0, function* () {
2043+ let retryCount = 0;
2044+ while (retryCount < 5) {
2045+ try {
2046+ yield streamExtractExternal(url, directory);
2047+ return;
2048+ }
2049+ catch (error) {
2050+ retryCount++;
2051+ core.debug(`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`);
2052+ // wait 5 seconds before retrying
2053+ yield new Promise(resolve => setTimeout(resolve, 5000));
2054+ }
2055+ }
2056+ throw new Error(`Artifact download failed after ${retryCount} retries.`);
2057+ });
2058+ }
2059+ function streamExtractExternal(url, directory) {
20422060 return __awaiter(this, void 0, void 0, function* () {
20432061 const client = new httpClient.HttpClient((0, user_agent_1.getUserAgentString)());
20442062 const response = yield client.get(url);
20452063 if (response.message.statusCode !== 200) {
20462064 throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`);
20472065 }
2066+ const timeout = 30 * 1000; // 30 seconds
20482067 return new Promise((resolve, reject) => {
2068+ const timerFn = () => {
2069+ response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`));
2070+ };
2071+ const timer = setTimeout(timerFn, timeout);
20492072 response.message
2073+ .on('data', () => {
2074+ timer.refresh();
2075+ })
2076+ .on('error', (error) => {
2077+ core.debug(`response.message: Artifact download failed: ${error.message}`);
2078+ clearTimeout(timer);
2079+ reject(error);
2080+ })
20502081 .pipe(unzip_stream_1.default.Extract({ path: directory }))
2051- .on('close', resolve)
2052- .on('error', reject);
2082+ .on('close', () => {
2083+ clearTimeout(timer);
2084+ resolve();
2085+ })
2086+ .on('error', (error) => {
2087+ reject(error);
2088+ });
20532089 });
20542090 });
20552091}
2092+ exports.streamExtractExternal = streamExtractExternal;
20562093function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, token, options) {
20572094 return __awaiter(this, void 0, void 0, function* () {
20582095 const downloadPath = yield resolveOrCreateDirectory(options === null || options === void 0 ? void 0 : options.path);
@@ -124851,7 +124888,7 @@ exports.unescape = unescape;
124851124888/***/ ((module) => {
124852124889
124853124890"use strict";
124854- module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.0.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
124891+ module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.0.1","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
124855124892
124856124893/***/ }),
124857124894
0 commit comments