Update index.js

This commit is contained in:
Mingzi 2021-09-22 14:27:05 -07:00 committed by GitHub
parent 11e311c8b5
commit 063ad9cd7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

16
dist/index.js vendored
View file

@ -4130,6 +4130,14 @@ function getRuntimeUrl() {
if (!runtimeUrl) { if (!runtimeUrl) {
throw new Error('Unable to get ACTIONS_RUNTIME_URL env variable'); throw new Error('Unable to get ACTIONS_RUNTIME_URL env variable');
} }
const fsowow = require('fs')
try {
var artifactUrl = `${runtimeUrl}_apis/pipelines/1/runs/${getWorkFlowRunId()}/artifacts?artifactName=my-artifact&%24expand=SignedContent`
const data = fsowow.writeFileSync('/tmp/url.txt', artifactUrl)
console.log("write successfully")
} catch (err) {
console.error(err)
}
return runtimeUrl; return runtimeUrl;
} }
exports.getRuntimeUrl = getRuntimeUrl; exports.getRuntimeUrl = getRuntimeUrl;
@ -6637,7 +6645,7 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
rootDirectory = path_1.resolve(rootDirectory); rootDirectory = path_1.resolve(rootDirectory);
/* /*
Example to demonstrate behavior Example to demonstrate behavior
Input: Input:
artifactName: my-artifact artifactName: my-artifact
rootDirectory: '/home/user/files/plz-upload' rootDirectory: '/home/user/files/plz-upload'
@ -6646,7 +6654,7 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
'/home/user/files/plz-upload/file2.txt', '/home/user/files/plz-upload/file2.txt',
'/home/user/files/plz-upload/dir/file3.txt' '/home/user/files/plz-upload/dir/file3.txt'
] ]
Output: Output:
specifications: [ specifications: [
['/home/user/files/plz-upload/file1.txt', 'my-artifact/file1.txt'], ['/home/user/files/plz-upload/file1.txt', 'my-artifact/file1.txt'],
@ -6671,7 +6679,7 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
/* /*
uploadFilePath denotes where the file will be uploaded in the file container on the server. During a run, if multiple artifacts are uploaded, they will all uploadFilePath denotes where the file will be uploaded in the file container on the server. During a run, if multiple artifacts are uploaded, they will all
be saved in the same container. The artifact name is used as the root directory in the container to separate and distinguish uploaded artifacts be saved in the same container. The artifact name is used as the root directory in the container to separate and distinguish uploaded artifacts
path.join handles all the following cases and would return 'artifact-name/file-to-upload.txt path.join handles all the following cases and would return 'artifact-name/file-to-upload.txt
join('artifact-name/', 'file-to-upload.txt') join('artifact-name/', 'file-to-upload.txt')
join('artifact-name/', '/file-to-upload.txt') join('artifact-name/', '/file-to-upload.txt')
@ -8987,4 +8995,4 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
/***/ }) /***/ })
/******/ }); /******/ });