mirror of
				https://github.com/actions/download-artifact.git
				synced 2025-10-31 16:23:41 +00:00 
			
		
		
		
	Update @actions/artifact from 0.3.5 to 0.4.2 (#73)
* Update @actions/artifact from 0.3.5 to 0.4.2 * Update package versions in .licenses
This commit is contained in:
		
							parent
							
								
									987de047e8
								
							
						
					
					
						commit
						f144d3c391
					
				
							
								
								
									
										2
									
								
								.licenses/npm/@actions/artifact.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/artifact.dep.yml
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| --- | ||||
| name: "@actions/artifact" | ||||
| version: 0.3.5 | ||||
| version: 0.4.2 | ||||
| type: npm | ||||
| summary: Actions artifact lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/artifact | ||||
|  | ||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/http-client.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/http-client.dep.yml
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| --- | ||||
| name: "@actions/http-client" | ||||
| version: 1.0.8 | ||||
| version: 1.0.9 | ||||
| type: npm | ||||
| summary: Actions Http Client | ||||
| homepage: https://github.com/actions/http-client#readme | ||||
|  | ||||
							
								
								
									
										137
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										137
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -3551,7 +3551,7 @@ class DefaultArtifactClient { | ||||
|             } | ||||
|             else { | ||||
|                 // Create an entry for the artifact in the file container
 | ||||
|                 const response = yield uploadHttpClient.createArtifactInFileContainer(name); | ||||
|                 const response = yield uploadHttpClient.createArtifactInFileContainer(name, options); | ||||
|                 if (!response.fileContainerResourceUrl) { | ||||
|                     core.debug(response.toString()); | ||||
|                     throw new Error('No URL provided by the Artifact Service to upload an artifact to'); | ||||
| @ -3720,6 +3720,10 @@ function getWorkSpaceDirectory() { | ||||
|     return workspaceDirectory; | ||||
| } | ||||
| exports.getWorkSpaceDirectory = getWorkSpaceDirectory; | ||||
| function getRetentionDays() { | ||||
|     return process.env['GITHUB_RETENTION_DAYS']; | ||||
| } | ||||
| exports.getRetentionDays = getRetentionDays; | ||||
| //# sourceMappingURL=config-variables.js.map
 | ||||
| 
 | ||||
| /***/ }), | ||||
| @ -4951,7 +4955,6 @@ exports.getDownloadSpecification = getDownloadSpecification; | ||||
| "use strict"; | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const url = __webpack_require__(835); | ||||
| const http = __webpack_require__(605); | ||||
| const https = __webpack_require__(211); | ||||
| const pm = __webpack_require__(950); | ||||
| @ -5000,7 +5003,7 @@ var MediaTypes; | ||||
|  * @param serverUrl  The server URL where the request will be sent. For example, https://api.github.com
 | ||||
|  */ | ||||
| function getProxyUrl(serverUrl) { | ||||
|     let proxyUrl = pm.getProxyUrl(url.parse(serverUrl)); | ||||
|     let proxyUrl = pm.getProxyUrl(new URL(serverUrl)); | ||||
|     return proxyUrl ? proxyUrl.href : ''; | ||||
| } | ||||
| exports.getProxyUrl = getProxyUrl; | ||||
| @ -5019,6 +5022,15 @@ const HttpResponseRetryCodes = [ | ||||
| const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; | ||||
| const ExponentialBackoffCeiling = 10; | ||||
| const ExponentialBackoffTimeSlice = 5; | ||||
| class HttpClientError extends Error { | ||||
|     constructor(message, statusCode) { | ||||
|         super(message); | ||||
|         this.name = 'HttpClientError'; | ||||
|         this.statusCode = statusCode; | ||||
|         Object.setPrototypeOf(this, HttpClientError.prototype); | ||||
|     } | ||||
| } | ||||
| exports.HttpClientError = HttpClientError; | ||||
| class HttpClientResponse { | ||||
|     constructor(message) { | ||||
|         this.message = message; | ||||
| @ -5037,7 +5049,7 @@ class HttpClientResponse { | ||||
| } | ||||
| exports.HttpClientResponse = HttpClientResponse; | ||||
| function isHttps(requestUrl) { | ||||
|     let parsedUrl = url.parse(requestUrl); | ||||
|     let parsedUrl = new URL(requestUrl); | ||||
|     return parsedUrl.protocol === 'https:'; | ||||
| } | ||||
| exports.isHttps = isHttps; | ||||
| @ -5142,7 +5154,7 @@ class HttpClient { | ||||
|         if (this._disposed) { | ||||
|             throw new Error('Client has already been disposed.'); | ||||
|         } | ||||
|         let parsedUrl = url.parse(requestUrl); | ||||
|         let parsedUrl = new URL(requestUrl); | ||||
|         let info = this._prepareRequest(verb, parsedUrl, headers); | ||||
|         // Only perform retries on reads since writes may not be idempotent.
 | ||||
|         let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 | ||||
| @ -5181,7 +5193,7 @@ class HttpClient { | ||||
|                     // if there's no location to redirect to, we won't
 | ||||
|                     break; | ||||
|                 } | ||||
|                 let parsedRedirectUrl = url.parse(redirectUrl); | ||||
|                 let parsedRedirectUrl = new URL(redirectUrl); | ||||
|                 if (parsedUrl.protocol == 'https:' && | ||||
|                     parsedUrl.protocol != parsedRedirectUrl.protocol && | ||||
|                     !this._allowRedirectDowngrade) { | ||||
| @ -5297,7 +5309,7 @@ class HttpClient { | ||||
|      * @param serverUrl  The server URL where the request will be sent. For example, https://api.github.com
 | ||||
|      */ | ||||
|     getAgent(serverUrl) { | ||||
|         let parsedUrl = url.parse(serverUrl); | ||||
|         let parsedUrl = new URL(serverUrl); | ||||
|         return this._getAgent(parsedUrl); | ||||
|     } | ||||
|     _prepareRequest(method, requestUrl, headers) { | ||||
| @ -5370,7 +5382,7 @@ class HttpClient { | ||||
|                 maxSockets: maxSockets, | ||||
|                 keepAlive: this._keepAlive, | ||||
|                 proxy: { | ||||
|                     proxyAuth: proxyUrl.auth, | ||||
|                     proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`, | ||||
|                     host: proxyUrl.hostname, | ||||
|                     port: proxyUrl.port | ||||
|                 } | ||||
| @ -5465,12 +5477,8 @@ class HttpClient { | ||||
|                 else { | ||||
|                     msg = 'Failed request: (' + statusCode + ')'; | ||||
|                 } | ||||
|                 let err = new Error(msg); | ||||
|                 // attach statusCode and body obj (if available) to the error object
 | ||||
|                 err['statusCode'] = statusCode; | ||||
|                 if (response.result) { | ||||
|                     err['result'] = response.result; | ||||
|                 } | ||||
|                 let err = new HttpClientError(msg, statusCode); | ||||
|                 err.result = response.result; | ||||
|                 reject(err); | ||||
|             } | ||||
|             else { | ||||
| @ -6002,12 +6010,17 @@ class UploadHttpClient { | ||||
|      * @param {string} artifactName Name of the artifact being created | ||||
|      * @returns The response from the Artifact Service if the file container was successfully created | ||||
|      */ | ||||
|     createArtifactInFileContainer(artifactName) { | ||||
|     createArtifactInFileContainer(artifactName, options) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const parameters = { | ||||
|                 Type: 'actions_storage', | ||||
|                 Name: artifactName | ||||
|             }; | ||||
|             // calculate retention period
 | ||||
|             if (options && options.retentionDays) { | ||||
|                 const maxRetentionStr = config_variables_1.getRetentionDays(); | ||||
|                 parameters.RetentionDays = utils_1.getProperRetention(options.retentionDays, maxRetentionStr); | ||||
|             } | ||||
|             const data = JSON.stringify(parameters, null, 2); | ||||
|             const artifactUrl = utils_1.getArtifactUrl(); | ||||
|             // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
 | ||||
| @ -6886,7 +6899,7 @@ class DownloadHttpClient { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             let retryCount = 0; | ||||
|             const retryLimit = config_variables_1.getRetryLimit(); | ||||
|             const destinationStream = fs.createWriteStream(downloadPath); | ||||
|             let destinationStream = fs.createWriteStream(downloadPath); | ||||
|             const headers = utils_1.getDownloadHeaders('application/json', true, true); | ||||
|             // a single GET request is used to download a file
 | ||||
|             const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () { | ||||
| @ -6922,11 +6935,29 @@ class DownloadHttpClient { | ||||
|                     core.info(`Finished backoff for retry #${retryCount}, continuing with download`); | ||||
|                 } | ||||
|             }); | ||||
|             const isAllBytesReceived = (expected, received) => { | ||||
|                 // be lenient, if any input is missing, assume success, i.e. not truncated
 | ||||
|                 if (!expected || | ||||
|                     !received || | ||||
|                     process.env['ACTIONS_ARTIFACT_SKIP_DOWNLOAD_VALIDATION']) { | ||||
|                     core.info('Skipping download validation.'); | ||||
|                     return true; | ||||
|                 } | ||||
|                 return parseInt(expected) === received; | ||||
|             }; | ||||
|             const resetDestinationStream = (fileDownloadPath) => __awaiter(this, void 0, void 0, function* () { | ||||
|                 destinationStream.close(); | ||||
|                 yield utils_1.rmFile(fileDownloadPath); | ||||
|                 destinationStream = fs.createWriteStream(fileDownloadPath); | ||||
|             }); | ||||
|             // keep trying to download a file until a retry limit has been reached
 | ||||
|             while (retryCount <= retryLimit) { | ||||
|                 let response; | ||||
|                 try { | ||||
|                     response = yield makeDownloadRequest(); | ||||
|                     if (core.isDebug()) { | ||||
|                         utils_1.displayHttpDiagnostics(response); | ||||
|                     } | ||||
|                 } | ||||
|                 catch (error) { | ||||
|                     // if an error is caught, it is usually indicative of a timeout so retry the download
 | ||||
| @ -6937,14 +6968,30 @@ class DownloadHttpClient { | ||||
|                     yield backOff(); | ||||
|                     continue; | ||||
|                 } | ||||
|                 let forceRetry = false; | ||||
|                 if (utils_1.isSuccessStatusCode(response.message.statusCode)) { | ||||
|                     // The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string
 | ||||
|                     // which can cause some gzip encoded data to be lost
 | ||||
|                     // Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents
 | ||||
|                     return this.pipeResponseToFile(response, destinationStream, isGzip(response.message.headers)); | ||||
|                     try { | ||||
|                         const isGzipped = isGzip(response.message.headers); | ||||
|                         yield this.pipeResponseToFile(response, destinationStream, isGzipped); | ||||
|                         if (isGzipped || | ||||
|                             isAllBytesReceived(response.message.headers['content-length'], yield utils_1.getFileSize(downloadPath))) { | ||||
|                             return; | ||||
|                         } | ||||
|                         else { | ||||
|                             forceRetry = true; | ||||
|                         } | ||||
|                     } | ||||
|                     catch (error) { | ||||
|                         // retry on error, most likely streams were corrupted
 | ||||
|                         forceRetry = true; | ||||
|                     } | ||||
|                 } | ||||
|                 else if (utils_1.isRetryableStatusCode(response.message.statusCode)) { | ||||
|                 if (forceRetry || utils_1.isRetryableStatusCode(response.message.statusCode)) { | ||||
|                     core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`); | ||||
|                     resetDestinationStream(downloadPath); | ||||
|                     // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
 | ||||
|                     utils_1.isThrottledStatusCode(response.message.statusCode) | ||||
|                         ? yield backOff(utils_1.tryGetRetryAfterValueTimeInMilliseconds(response.message.headers)) | ||||
| @ -6970,24 +7017,40 @@ class DownloadHttpClient { | ||||
|                 if (isGzip) { | ||||
|                     const gunzip = zlib.createGunzip(); | ||||
|                     response.message | ||||
|                         .on('error', error => { | ||||
|                         core.error(`An error occurred while attempting to read the response stream`); | ||||
|                         gunzip.close(); | ||||
|                         destinationStream.close(); | ||||
|                         reject(error); | ||||
|                     }) | ||||
|                         .pipe(gunzip) | ||||
|                         .on('error', error => { | ||||
|                         core.error(`An error occurred while attempting to decompress the response stream`); | ||||
|                         destinationStream.close(); | ||||
|                         reject(error); | ||||
|                     }) | ||||
|                         .pipe(destinationStream) | ||||
|                         .on('close', () => { | ||||
|                         resolve(); | ||||
|                     }) | ||||
|                         .on('error', error => { | ||||
|                         core.error(`An error has been encountered while decompressing and writing a downloaded file to ${destinationStream.path}`); | ||||
|                         core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`); | ||||
|                         reject(error); | ||||
|                     }); | ||||
|                 } | ||||
|                 else { | ||||
|                     response.message | ||||
|                         .on('error', error => { | ||||
|                         core.error(`An error occurred while attempting to read the response stream`); | ||||
|                         destinationStream.close(); | ||||
|                         reject(error); | ||||
|                     }) | ||||
|                         .pipe(destinationStream) | ||||
|                         .on('close', () => { | ||||
|                         resolve(); | ||||
|                     }) | ||||
|                         .on('error', error => { | ||||
|                         core.error(`An error has been encountered while writing a downloaded file to ${destinationStream.path}`); | ||||
|                         core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`); | ||||
|                         reject(error); | ||||
|                     }); | ||||
|                 } | ||||
| @ -7520,6 +7583,35 @@ function createEmptyFilesForArtifact(emptyFilesToCreate) { | ||||
|     }); | ||||
| } | ||||
| exports.createEmptyFilesForArtifact = createEmptyFilesForArtifact; | ||||
| function getFileSize(filePath) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         const stats = yield fs_1.promises.stat(filePath); | ||||
|         core_1.debug(`${filePath} size:(${stats.size}) blksize:(${stats.blksize}) blocks:(${stats.blocks})`); | ||||
|         return stats.size; | ||||
|     }); | ||||
| } | ||||
| exports.getFileSize = getFileSize; | ||||
| function rmFile(filePath) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         yield fs_1.promises.unlink(filePath); | ||||
|     }); | ||||
| } | ||||
| exports.rmFile = rmFile; | ||||
| function getProperRetention(retentionInput, retentionSetting) { | ||||
|     if (retentionInput < 0) { | ||||
|         throw new Error('Invalid retention, minimum value is 1.'); | ||||
|     } | ||||
|     let retention = retentionInput; | ||||
|     if (retentionSetting) { | ||||
|         const maxRetention = parseInt(retentionSetting); | ||||
|         if (!isNaN(maxRetention) && maxRetention < retention) { | ||||
|             core_1.warning(`Retention days is greater than the max value allowed by the repository setting, reduce retention to ${maxRetention} days`); | ||||
|             retention = maxRetention; | ||||
|         } | ||||
|     } | ||||
|     return retention; | ||||
| } | ||||
| exports.getProperRetention = getProperRetention; | ||||
| //# sourceMappingURL=utils.js.map
 | ||||
| 
 | ||||
| /***/ }), | ||||
| @ -7600,12 +7692,11 @@ var isArray = Array.isArray || function (xs) { | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 950: | ||||
| /***/ (function(__unusedmodule, exports, __webpack_require__) { | ||||
| /***/ (function(__unusedmodule, exports) { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const url = __webpack_require__(835); | ||||
| function getProxyUrl(reqUrl) { | ||||
|     let usingSsl = reqUrl.protocol === 'https:'; | ||||
|     let proxyUrl; | ||||
| @ -7620,7 +7711,7 @@ function getProxyUrl(reqUrl) { | ||||
|         proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; | ||||
|     } | ||||
|     if (proxyVar) { | ||||
|         proxyUrl = url.parse(proxyVar); | ||||
|         proxyUrl = new URL(proxyVar); | ||||
|     } | ||||
|     return proxyUrl; | ||||
| } | ||||
|  | ||||
							
								
								
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -5,11 +5,11 @@ | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
|     "@actions/artifact": { | ||||
|       "version": "0.3.5", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.3.5.tgz", | ||||
|       "integrity": "sha512-y27pBEnUjOqCP2zUf86YkiqGOp1r0C9zUOmGmcxizsHMls0wvk+FJwd+l8JIoukvj1BeBHYP+c+9AEqOt5AqMA==", | ||||
|       "version": "0.4.2", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.4.2.tgz", | ||||
|       "integrity": "sha512-vXbHfJbAwx8mqg7ZUCW6Vc3hG1GvM5wEMJjaVhXJIbyLeZCIIA8WgDvPA7Ag3OWtF5s15jF/jUIkGdxaCwmCbQ==", | ||||
|       "requires": { | ||||
|         "@actions/core": "^1.2.1", | ||||
|         "@actions/core": "^1.2.6", | ||||
|         "@actions/http-client": "^1.0.7", | ||||
|         "@types/tmp": "^0.1.0", | ||||
|         "tmp": "^0.1.0", | ||||
| @ -32,9 +32,9 @@ | ||||
|       "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" | ||||
|     }, | ||||
|     "@actions/http-client": { | ||||
|       "version": "1.0.8", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", | ||||
|       "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", | ||||
|       "version": "1.0.9", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz", | ||||
|       "integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==", | ||||
|       "requires": { | ||||
|         "tunnel": "0.0.6" | ||||
|       } | ||||
|  | ||||
| @ -28,7 +28,7 @@ | ||||
|   }, | ||||
|   "homepage": "https://github.com/actions/download-artifact#readme", | ||||
|   "dependencies": { | ||||
|     "@actions/artifact": "^0.3.5", | ||||
|     "@actions/artifact": "^0.4.2", | ||||
|     "@actions/core": "^1.2.6" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user