Compare commits

...

21 Commits

Author SHA1 Message Date
Rob Herley 09020dd482
debug 2023-12-06 19:01:28 -05:00
Rob Herley b0b830af8c
r 2023-12-06 18:52:51 -05:00
Rob Herley 1c268a9bf7
fix 2023-12-06 18:49:32 -05:00
Rob Herley ba1cd59001
pls work 2023-12-06 18:31:29 -05:00
Rob Herley 043b92bdd5
does this work? 2023-12-06 18:25:46 -05:00
Rob Herley 797c550946
. 2023-12-06 18:22:49 -05:00
Rob Herley 0b8860f406
again 2023-12-06 18:21:33 -05:00
Rob Herley 7aec5deb0e
more 2023-12-06 18:20:01 -05:00
Rob Herley d48048aac5
ncc 2023-12-06 18:12:10 -05:00
Rob Herley 6253cc74af
kill 2023-12-06 18:11:45 -05:00
Rob Herley c41b3a9519
. 2023-12-06 18:08:38 -05:00
Rob Herley 1f3c0c57c9
ncc 2023-12-06 18:05:50 -05:00
Rob Herley 11b9048092
ncc 2023-12-06 17:36:08 -05:00
Rob Herley 40c8ff5a04
. 2023-12-06 17:34:03 -05:00
Rob Herley e2f97976bb
. 2023-12-06 17:30:47 -05:00
Rob Herley 10da87367e
more 2023-12-06 17:27:10 -05:00
Rob Herley 07bdee9a57
more debug 2023-12-06 17:23:51 -05:00
Rob Herley 49bd7df5e8
16? 2023-12-06 17:17:01 -05:00
Rob Herley d9a12ec708
manual tweaks 2023-12-06 17:10:39 -05:00
Rob Herley 931bdcf052
ncc 2023-12-06 16:53:54 -05:00
Rob Herley 9d50cd2fe1
use patched http-client 2023-12-06 16:38:02 -05:00
3 changed files with 388 additions and 217 deletions

448
dist/index.js vendored
View File

@ -3153,16 +3153,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.create = void 0;
const client_1 = __nccwpck_require__(23955); const client_1 = __nccwpck_require__(23955);
/**
* Exported functionality that we want to expose for any users of @actions/artifact
*/
__exportStar(__nccwpck_require__(2538), exports); __exportStar(__nccwpck_require__(2538), exports);
function create() { __exportStar(__nccwpck_require__(69398), exports);
return client_1.Client.create(); __exportStar(__nccwpck_require__(23955), exports);
} const client = new client_1.DefaultArtifactClient();
exports.create = create; exports["default"] = client;
//# sourceMappingURL=artifact.js.map //# sourceMappingURL=artifact.js.map
/***/ }), /***/ }),
@ -4998,32 +4994,24 @@ var __rest = (this && this.__rest) || function (s, e) {
return t; return t;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Client = void 0; exports.DefaultArtifactClient = void 0;
const core_1 = __nccwpck_require__(66526); const core_1 = __nccwpck_require__(66526);
const config_1 = __nccwpck_require__(95042); const config_1 = __nccwpck_require__(95042);
const upload_artifact_1 = __nccwpck_require__(86278); const upload_artifact_1 = __nccwpck_require__(86278);
const download_artifact_1 = __nccwpck_require__(17306); const download_artifact_1 = __nccwpck_require__(17306);
const get_artifact_1 = __nccwpck_require__(56218); const get_artifact_1 = __nccwpck_require__(56218);
const list_artifacts_1 = __nccwpck_require__(64033); const list_artifacts_1 = __nccwpck_require__(64033);
class Client { const errors_1 = __nccwpck_require__(69398);
/** /**
* Constructs a Client * The default artifact client that is used by the artifact action(s).
*/ */
static create() { class DefaultArtifactClient {
return new Client();
}
/**
* Upload Artifact
*/
uploadArtifact(name, files, rootDirectory, options) { uploadArtifact(name, files, rootDirectory, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if ((0, config_1.isGhes)()) {
(0, core_1.warning)(`@actions/artifact v2.0.0+ and upload-artifact@v4+ are not currently supported on GHES.`);
return {
success: false
};
}
try { try {
if ((0, config_1.isGhes)()) {
throw new errors_1.GHESNotSupportedError();
}
return (0, upload_artifact_1.uploadArtifact)(name, files, rootDirectory, options); return (0, upload_artifact_1.uploadArtifact)(name, files, rootDirectory, options);
} }
catch (error) { catch (error) {
@ -5032,24 +5020,16 @@ class Client {
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
If the error persists, please check whether Actions is operating normally at [https://githubstatus.com](https://www.githubstatus.com).`); If the error persists, please check whether Actions is operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
return { throw error;
success: false
};
} }
}); });
} }
/**
* Download Artifact
*/
downloadArtifact(artifactId, options) { downloadArtifact(artifactId, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if ((0, config_1.isGhes)()) {
(0, core_1.warning)(`@actions/artifact v2.0.0+ and download-artifact@v4+ are not currently supported on GHES.`);
return {
success: false
};
}
try { try {
if ((0, config_1.isGhes)()) {
throw new errors_1.GHESNotSupportedError();
}
if (options === null || options === void 0 ? void 0 : options.findBy) { if (options === null || options === void 0 ? void 0 : options.findBy) {
const { findBy: { repositoryOwner, repositoryName, token } } = options, downloadOptions = __rest(options, ["findBy"]); const { findBy: { repositoryOwner, repositoryName, token } } = options, downloadOptions = __rest(options, ["findBy"]);
return (0, download_artifact_1.downloadArtifactPublic)(artifactId, repositoryOwner, repositoryName, token, downloadOptions); return (0, download_artifact_1.downloadArtifactPublic)(artifactId, repositoryOwner, repositoryName, token, downloadOptions);
@ -5057,29 +5037,21 @@ If the error persists, please check whether Actions is operating normally at [ht
return (0, download_artifact_1.downloadArtifactInternal)(artifactId, options); return (0, download_artifact_1.downloadArtifactInternal)(artifactId, options);
} }
catch (error) { catch (error) {
(0, core_1.warning)(`Artifact download failed with error: ${error}. (0, core_1.warning)(`Download Artifact failed with error: ${error}.
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`); If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
return { throw error;
success: false
};
} }
}); });
} }
/**
* List Artifacts
*/
listArtifacts(options) { listArtifacts(options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if ((0, config_1.isGhes)()) {
(0, core_1.warning)(`@actions/artifact v2.0.0+ and download-artifact@v4+ are not currently supported on GHES.`);
return {
artifacts: []
};
}
try { try {
if ((0, config_1.isGhes)()) {
throw new errors_1.GHESNotSupportedError();
}
if (options === null || options === void 0 ? void 0 : options.findBy) { if (options === null || options === void 0 ? void 0 : options.findBy) {
const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options; const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options;
return (0, list_artifacts_1.listArtifactsPublic)(workflowRunId, repositoryOwner, repositoryName, token, options === null || options === void 0 ? void 0 : options.latest); return (0, list_artifacts_1.listArtifactsPublic)(workflowRunId, repositoryOwner, repositoryName, token, options === null || options === void 0 ? void 0 : options.latest);
@ -5092,24 +5064,16 @@ If the error persists, please check whether Actions and API requests are operati
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`); If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
return { throw error;
artifacts: []
};
} }
}); });
} }
/**
* Get Artifact
*/
getArtifact(artifactName, options) { getArtifact(artifactName, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if ((0, config_1.isGhes)()) {
(0, core_1.warning)(`@actions/artifact v2.0.0+ and download-artifact@v4+ are not currently supported on GHES.`);
return {
success: false
};
}
try { try {
if ((0, config_1.isGhes)()) {
throw new errors_1.GHESNotSupportedError();
}
if (options === null || options === void 0 ? void 0 : options.findBy) { if (options === null || options === void 0 ? void 0 : options.findBy) {
const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options; const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options;
return (0, get_artifact_1.getArtifactPublic)(artifactName, workflowRunId, repositoryOwner, repositoryName, token); return (0, get_artifact_1.getArtifactPublic)(artifactName, workflowRunId, repositoryOwner, repositoryName, token);
@ -5117,19 +5081,17 @@ If the error persists, please check whether Actions and API requests are operati
return (0, get_artifact_1.getArtifactInternal)(artifactName); return (0, get_artifact_1.getArtifactInternal)(artifactName);
} }
catch (error) { catch (error) {
(0, core_1.warning)(`Fetching Artifact failed with error: ${error}. (0, core_1.warning)(`Get Artifact failed with error: ${error}.
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`); If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
return { throw error;
success: false
};
} }
}); });
} }
} }
exports.Client = Client; exports.DefaultArtifactClient = DefaultArtifactClient;
//# sourceMappingURL=client.js.map //# sourceMappingURL=client.js.map
/***/ }), /***/ }),
@ -5186,6 +5148,7 @@ const config_1 = __nccwpck_require__(95042);
const artifact_twirp_client_1 = __nccwpck_require__(63550); const artifact_twirp_client_1 = __nccwpck_require__(63550);
const generated_1 = __nccwpck_require__(90265); const generated_1 = __nccwpck_require__(90265);
const util_1 = __nccwpck_require__(80565); const util_1 = __nccwpck_require__(80565);
const errors_1 = __nccwpck_require__(69398);
const scrubQueryParameters = (url) => { const scrubQueryParameters = (url) => {
const parsed = new URL(url); const parsed = new URL(url);
parsed.search = ''; parsed.search = '';
@ -5247,7 +5210,7 @@ function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, tok
catch (error) { catch (error) {
throw new Error(`Unable to download and extract artifact: ${error.message}`); throw new Error(`Unable to download and extract artifact: ${error.message}`);
} }
return { success: true, downloadPath }; return { downloadPath };
}); });
} }
exports.downloadArtifactPublic = downloadArtifactPublic; exports.downloadArtifactPublic = downloadArtifactPublic;
@ -5263,8 +5226,7 @@ function downloadArtifactInternal(artifactId, options) {
}; };
const { artifacts } = yield artifactClient.ListArtifacts(listReq); const { artifacts } = yield artifactClient.ListArtifacts(listReq);
if (artifacts.length === 0) { if (artifacts.length === 0) {
core.warning(`No artifacts found for ID: ${artifactId}\nAre you trying to download from a different run? Try specifying a github-token with \`actions:read\` scope.`); throw new errors_1.ArtifactNotFoundError(`No artifacts found for ID: ${artifactId}\nAre you trying to download from a different run? Try specifying a github-token with \`actions:read\` scope.`);
return { success: false };
} }
if (artifacts.length > 1) { if (artifacts.length > 1) {
core.warning('Multiple artifacts found, defaulting to first.'); core.warning('Multiple artifacts found, defaulting to first.');
@ -5284,7 +5246,7 @@ function downloadArtifactInternal(artifactId, options) {
catch (error) { catch (error) {
throw new Error(`Unable to download and extract artifact: ${error.message}`); throw new Error(`Unable to download and extract artifact: ${error.message}`);
} }
return { success: true, downloadPath }; return { downloadPath };
}); });
} }
exports.downloadArtifactInternal = downloadArtifactInternal; exports.downloadArtifactInternal = downloadArtifactInternal;
@ -5353,7 +5315,9 @@ const util_1 = __nccwpck_require__(80565);
const user_agent_1 = __nccwpck_require__(79681); const user_agent_1 = __nccwpck_require__(79681);
const artifact_twirp_client_1 = __nccwpck_require__(63550); const artifact_twirp_client_1 = __nccwpck_require__(63550);
const generated_1 = __nccwpck_require__(90265); const generated_1 = __nccwpck_require__(90265);
const errors_1 = __nccwpck_require__(69398);
function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) {
var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults);
const opts = { const opts = {
@ -5371,16 +5335,10 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit
name: artifactName name: artifactName
}); });
if (getArtifactResp.status !== 200) { if (getArtifactResp.status !== 200) {
core.warning(`non-200 response from GitHub API: ${getArtifactResp.status}`); throw new errors_1.InvalidResponseError(`Invalid response from GitHub API: ${getArtifactResp.status} (${(_a = getArtifactResp === null || getArtifactResp === void 0 ? void 0 : getArtifactResp.headers) === null || _a === void 0 ? void 0 : _a['x-github-request-id']})`);
return {
success: false
};
} }
if (getArtifactResp.data.artifacts.length === 0) { if (getArtifactResp.data.artifacts.length === 0) {
core.warning('no artifacts found'); throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`);
return {
success: false
};
} }
let artifact = getArtifactResp.data.artifacts[0]; let artifact = getArtifactResp.data.artifacts[0];
if (getArtifactResp.data.artifacts.length > 1) { if (getArtifactResp.data.artifacts.length > 1) {
@ -5388,7 +5346,6 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit
core.debug(`More than one artifact found for a single name, returning newest (id: ${artifact.id})`); core.debug(`More than one artifact found for a single name, returning newest (id: ${artifact.id})`);
} }
return { return {
success: true,
artifact: { artifact: {
name: artifact.name, name: artifact.name,
id: artifact.id, id: artifact.id,
@ -5410,18 +5367,14 @@ function getArtifactInternal(artifactName) {
}; };
const res = yield artifactClient.ListArtifacts(req); const res = yield artifactClient.ListArtifacts(req);
if (res.artifacts.length === 0) { if (res.artifacts.length === 0) {
core.warning('no artifacts found'); throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`);
return {
success: false
};
} }
let artifact = res.artifacts[0]; let artifact = res.artifacts[0];
if (res.artifacts.length > 1) { if (res.artifacts.length > 1) {
artifact = res.artifacts.sort((a, b) => Number(b.databaseId) - Number(a.databaseId))[0]; artifact = res.artifacts.sort((a, b) => Number(b.databaseId) - Number(a.databaseId))[0];
core.debug(`more than one artifact found for a single name, returning newest (id: ${artifact.databaseId})`); core.debug(`More than one artifact found for a single name, returning newest (id: ${artifact.databaseId})`);
} }
return { return {
success: true,
artifact: { artifact: {
name: artifact.name, name: artifact.name,
id: Number(artifact.databaseId), id: Number(artifact.databaseId),
@ -5693,8 +5646,7 @@ class ArtifactHttpClient {
'Content-Type': contentType 'Content-Type': contentType
}; };
try { try {
const response = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); })); const { body } = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); }));
const body = yield response.readBody();
return JSON.parse(body); return JSON.parse(body);
} }
catch (error) { catch (error) {
@ -5711,10 +5663,12 @@ class ArtifactHttpClient {
try { try {
const response = yield operation(); const response = yield operation();
const statusCode = response.message.statusCode; const statusCode = response.message.statusCode;
(0, core_1.debug)(`[Response] ${response.message.statusCode}`); const body = yield response.readBody();
(0, core_1.debug)(JSON.stringify(response.message.headers, null, 2)); (0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
(0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
(0, core_1.debug)(`Body: ${body}`);
if (this.isSuccessStatusCode(statusCode)) { if (this.isSuccessStatusCode(statusCode)) {
return response; return { response, body };
} }
isRetryable = this.isRetryableHttpStatusCode(statusCode); isRetryable = this.isRetryableHttpStatusCode(statusCode);
errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`; errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`;
@ -5844,6 +5798,50 @@ exports.getConcurrency = getConcurrency;
/***/ }), /***/ }),
/***/ 69398:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GHESNotSupportedError = exports.ArtifactNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
class FilesNotFoundError extends Error {
constructor(files = []) {
let message = 'No files were found to upload';
if (files.length > 0) {
message += `: ${files.join(', ')}`;
}
super(message);
this.files = files;
this.name = 'FilesNotFoundError';
}
}
exports.FilesNotFoundError = FilesNotFoundError;
class InvalidResponseError extends Error {
constructor(message) {
super(message);
this.name = 'InvalidResponseError';
}
}
exports.InvalidResponseError = InvalidResponseError;
class ArtifactNotFoundError extends Error {
constructor(message = 'Artifact not found') {
super(message);
this.name = 'ArtifactNotFoundError';
}
}
exports.ArtifactNotFoundError = ArtifactNotFoundError;
class GHESNotSupportedError extends Error {
constructor(message = '@actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.') {
super(message);
this.name = 'GHESNotSupportedError';
}
}
exports.GHESNotSupportedError = GHESNotSupportedError;
//# sourceMappingURL=errors.js.map
/***/ }),
/***/ 2538: /***/ 2538:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
@ -6027,28 +6025,16 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
const hashStream = crypto.createHash('sha256'); const hashStream = crypto.createHash('sha256');
zipUploadStream.pipe(uploadStream); // This stream is used for the upload zipUploadStream.pipe(uploadStream); // This stream is used for the upload
zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check
try { core.info('Beginning upload of artifact content to blob storage');
core.info('Beginning upload of artifact content to blob storage'); yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options);
yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options); core.info('Finished uploading artifact content to blob storage!');
core.info('Finished uploading artifact content to blob storage!'); hashStream.end();
hashStream.end(); sha256Hash = hashStream.read();
sha256Hash = hashStream.read(); core.info(`SHA256 hash of uploaded artifact zip is ${sha256Hash}`);
core.info(`SHA256 hash of uploaded artifact zip is ${sha256Hash}`);
}
catch (error) {
core.warning(`Failed to upload artifact zip to blob storage, error: ${error}`);
return {
isSuccess: false
};
}
if (uploadByteCount === 0) { if (uploadByteCount === 0) {
core.warning(`No data was uploaded to blob storage. Reported upload byte count is 0`); core.warning(`No data was uploaded to blob storage. Reported upload byte count is 0.`);
return {
isSuccess: false
};
} }
return { return {
isSuccess: true,
uploadSize: uploadByteCount, uploadSize: uploadByteCount,
sha256Hash sha256Hash
}; };
@ -6242,18 +6228,15 @@ const util_1 = __nccwpck_require__(80565);
const blob_upload_1 = __nccwpck_require__(63311); const blob_upload_1 = __nccwpck_require__(63311);
const zip_1 = __nccwpck_require__(6180); const zip_1 = __nccwpck_require__(6180);
const generated_1 = __nccwpck_require__(90265); const generated_1 = __nccwpck_require__(90265);
const errors_1 = __nccwpck_require__(69398);
function uploadArtifact(name, files, rootDirectory, options) { function uploadArtifact(name, files, rootDirectory, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
(0, path_and_artifact_name_validation_1.validateArtifactName)(name); (0, path_and_artifact_name_validation_1.validateArtifactName)(name);
(0, upload_zip_specification_1.validateRootDirectory)(rootDirectory); (0, upload_zip_specification_1.validateRootDirectory)(rootDirectory);
const zipSpecification = (0, upload_zip_specification_1.getUploadZipSpecification)(files, rootDirectory); const zipSpecification = (0, upload_zip_specification_1.getUploadZipSpecification)(files, rootDirectory);
if (zipSpecification.length === 0) { if (zipSpecification.length === 0) {
core.warning(`No files were found to upload`); throw new errors_1.FilesNotFoundError(zipSpecification.flatMap(s => (s.sourcePath ? [s.sourcePath] : [])));
return {
success: false
};
} }
const zipUploadStream = yield (0, zip_1.createZipUploadStream)(zipSpecification, options === null || options === void 0 ? void 0 : options.compressionLevel);
// get the IDs needed for the artifact creation // get the IDs needed for the artifact creation
const backendIds = (0, util_1.getBackendIdsFromToken)(); const backendIds = (0, util_1.getBackendIdsFromToken)();
// create the artifact client // create the artifact client
@ -6272,18 +6255,11 @@ function uploadArtifact(name, files, rootDirectory, options) {
} }
const createArtifactResp = yield artifactClient.CreateArtifact(createArtifactReq); const createArtifactResp = yield artifactClient.CreateArtifact(createArtifactReq);
if (!createArtifactResp.ok) { if (!createArtifactResp.ok) {
core.warning(`Failed to create artifact`); throw new errors_1.InvalidResponseError('CreateArtifact: response from backend was not ok');
return {
success: false
};
} }
const zipUploadStream = yield (0, zip_1.createZipUploadStream)(zipSpecification, options === null || options === void 0 ? void 0 : options.compressionLevel);
// Upload zip to blob storage // Upload zip to blob storage
const uploadResult = yield (0, blob_upload_1.uploadZipToBlobStorage)(createArtifactResp.signedUploadUrl, zipUploadStream); const uploadResult = yield (0, blob_upload_1.uploadZipToBlobStorage)(createArtifactResp.signedUploadUrl, zipUploadStream);
if (uploadResult.isSuccess === false) {
return {
success: false
};
}
// finalize the artifact // finalize the artifact
const finalizeArtifactReq = { const finalizeArtifactReq = {
workflowRunBackendId: backendIds.workflowRunBackendId, workflowRunBackendId: backendIds.workflowRunBackendId,
@ -6299,15 +6275,11 @@ function uploadArtifact(name, files, rootDirectory, options) {
core.info(`Finalizing artifact upload`); core.info(`Finalizing artifact upload`);
const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq); const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq);
if (!finalizeArtifactResp.ok) { if (!finalizeArtifactResp.ok) {
core.warning(`Failed to finalize artifact`); throw new errors_1.InvalidResponseError('FinalizeArtifact: response from backend was not ok');
return {
success: false
};
} }
const artifactId = BigInt(finalizeArtifactResp.artifactId); const artifactId = BigInt(finalizeArtifactResp.artifactId);
core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`); core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`);
return { return {
success: true,
size: uploadResult.uploadSize, size: uploadResult.uploadSize,
id: Number(artifactId) id: Number(artifactId)
}; };
@ -120836,6 +120808,123 @@ function regExpEscape (s) {
} }
/***/ }),
/***/ 26819:
/***/ ((module) => {
// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function FormatStackTrace(error, frames) {
var lines = [];
try {
lines.push(error.toString());
} catch (e) {
try {
lines.push("<error: " + e + ">");
} catch (ee) {
lines.push("<error>");
}
}
for (var i = 0; i < frames.length; i++) {
var frame = frames[i];
var line;
try {
line = frame.toString();
} catch (e) {
try {
line = "<error: " + e + ">";
} catch (ee) {
// Any code that reaches this point is seriously nasty!
line = "<error>";
}
}
lines.push(" at " + line);
}
return lines.join("\n");
}
module.exports = FormatStackTrace;
/***/ }),
/***/ 14208:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
// v8 builtin format stack trace
// for when there was no previous prepareStackTrace function to call
var FormatStackTrace = __nccwpck_require__(26819);
// some notes on the behavior below:
// because the 'stack' member is a one shot access variable (the raw stack is
// formatted on accessing it)
// we try to avoid modifying what the user would have wanted
// thus we use the previous value for prepareStackTrace
//
// The reason we store the callsite variable is because prepareStackTrace
// will not be called again once it has been called for a given error object
// but we want to support getting the stack out of the error multiple times (cause why not)
module.exports = function(err) {
// save original stacktrace
var save = Error.prepareStackTrace;
// replace capture with our function
Error.prepareStackTrace = function(err, trace) {
// cache stack frames so we don't have to get them again
// use a non-enumerable property
Object.defineProperty(err, '_sb_callsites', {
value: trace
});
return (save || FormatStackTrace)(err, trace);
};
// force capture of the stack frames
err.stack;
// someone already asked for the stack so we can't do this trick
// TODO fallback to string parsing?
if (!err._sb_callsites) {
return [];
}
// return original capture function
Error.prepareStackTrace = save;
return err._sb_callsites;
};
/***/ }), /***/ }),
/***/ 74294: /***/ 74294:
@ -121762,6 +121851,80 @@ function version(uuid) {
var _default = version; var _default = version;
exports["default"] = _default; exports["default"] = _default;
/***/ }),
/***/ 49719:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
var asyncHooks = __nccwpck_require__(50852)
var stackback = __nccwpck_require__(14208)
var path = __nccwpck_require__(71017)
var fs = __nccwpck_require__(57147)
var sep = path.sep
var active = new Map()
var hook = asyncHooks.createHook({
init (asyncId, type, triggerAsyncId, resource) {
if (type === 'TIMERWRAP' || type === 'PROMISE') return
if (type === 'PerformanceObserver' || type === 'RANDOMBYTESREQUEST') return
var err = new Error('whatevs')
var stacks = stackback(err)
active.set(asyncId, {type, stacks, resource})
},
destroy (asyncId) {
active.delete(asyncId)
}
})
hook.enable()
module.exports = whyIsNodeRunning
function whyIsNodeRunning (logger) {
if (!logger) logger = console
hook.disable()
var activeResources = [...active.values()].filter(function(r) {
if (
typeof r.resource.hasRef === 'function'
&& !r.resource.hasRef()
) return false
return true
})
logger.error('There are %d handle(s) keeping the process running', activeResources.length)
for (const o of activeResources) printStacks(o)
function printStacks (o) {
var stacks = o.stacks.slice(1).filter(function (s) {
var filename = s.getFileName()
return filename && filename.indexOf(sep) > -1 && filename.indexOf('internal' + sep) !== 0
})
logger.error('')
logger.error('# %s', o.type)
if (!stacks[0]) {
logger.error('(unknown stack trace)')
} else {
var padding = ''
stacks.forEach(function (s) {
var pad = (s.getFileName() + ':' + s.getLineNumber()).replace(/./g, ' ')
if (pad.length > padding.length) padding = pad
})
stacks.forEach(function (s) {
var prefix = s.getFileName() + ':' + s.getLineNumber()
try {
var src = fs.readFileSync(s.getFileName(), 'utf-8').split(/\n|\r\n/)
logger.error(prefix + padding.slice(prefix.length) + ' - ' + src[s.getLineNumber() - 1].trim())
} catch (e) {
logger.error(prefix + padding.slice(prefix.length))
}
})
}
}
}
/***/ }), /***/ }),
/***/ 69042: /***/ 69042:
@ -122076,9 +122239,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const why_is_node_running_1 = __importDefault(__nccwpck_require__(49719));
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const artifact_1 = __nccwpck_require__(99860); const artifact_1 = __importDefault(__nccwpck_require__(99860));
const search_1 = __nccwpck_require__(13930); const search_1 = __nccwpck_require__(13930);
const input_helper_1 = __nccwpck_require__(46455); const input_helper_1 = __nccwpck_require__(46455);
const constants_1 = __nccwpck_require__(69042); const constants_1 = __nccwpck_require__(69042);
@ -122108,7 +122275,6 @@ function run() {
const s = searchResult.filesToUpload.length === 1 ? '' : 's'; const s = searchResult.filesToUpload.length === 1 ? '' : 's';
core.info(`With the provided path, there will be ${searchResult.filesToUpload.length} file${s} uploaded`); core.info(`With the provided path, there will be ${searchResult.filesToUpload.length} file${s} uploaded`);
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`); core.debug(`Root artifact directory is ${searchResult.rootDirectory}`);
const artifactClient = (0, artifact_1.create)();
const options = {}; const options = {};
if (inputs.retentionDays) { if (inputs.retentionDays) {
options.retentionDays = inputs.retentionDays; options.retentionDays = inputs.retentionDays;
@ -122116,18 +122282,14 @@ function run() {
if (typeof inputs.compressionLevel !== 'undefined') { if (typeof inputs.compressionLevel !== 'undefined') {
options.compressionLevel = inputs.compressionLevel; options.compressionLevel = inputs.compressionLevel;
} }
const uploadResponse = yield artifactClient.uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options); const uploadResponse = yield artifact_1.default.uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options);
if (uploadResponse.success === false) { core.info(`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`);
core.setFailed(`An error was encountered when uploading ${inputs.artifactName}.`); core.setOutput('artifact-id', uploadResponse.id);
}
else {
core.info(`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`);
core.setOutput('artifact-id', uploadResponse.id);
}
} }
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
(0, why_is_node_running_1.default)();
} }
}); });
} }
@ -122144,6 +122306,14 @@ module.exports = require("assert");
/***/ }), /***/ }),
/***/ 50852:
/***/ ((module) => {
"use strict";
module.exports = require("async_hooks");
/***/ }),
/***/ 14300: /***/ 14300:
/***/ ((module) => { /***/ ((module) => {

132
package-lock.json generated
View File

@ -9,10 +9,10 @@
"version": "3.0.0", "version": "3.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/artifact": "^1.1.1",
"@actions/core": "^1.10.0", "@actions/core": "^1.10.0",
"@actions/glob": "^0.3.0", "@actions/glob": "^0.3.0",
"@actions/io": "^1.1.2" "@actions/io": "^1.1.2",
"why-is-node-running": "^2.2.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.2.5", "@types/jest": "^29.2.5",
@ -31,17 +31,6 @@
"typescript": "^4.9.4" "typescript": "^4.9.4"
} }
}, },
"node_modules/@actions/artifact": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.1.1.tgz",
"integrity": "sha512-Vv4y0EW0ptEkU+Pjs5RGS/0EryTvI6s79LjSV9Gg/h+O3H/ddpjhuX/Bi/HZE4pbNPyjGtQjbdFWphkZhmgabA==",
"dependencies": {
"@actions/core": "^1.9.1",
"@actions/http-client": "^2.0.1",
"tmp": "^0.2.1",
"tmp-promise": "^3.0.2"
}
},
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
@ -3165,7 +3154,8 @@
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
}, },
"node_modules/fsevents": { "node_modules/fsevents": {
"version": "2.3.2", "version": "2.3.2",
@ -3550,6 +3540,7 @@
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"dependencies": { "dependencies": {
"once": "^1.3.0", "once": "^1.3.0",
"wrappy": "1" "wrappy": "1"
@ -3558,7 +3549,8 @@
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
}, },
"node_modules/internal-slot": { "node_modules/internal-slot": {
"version": "1.0.4", "version": "1.0.4",
@ -4913,6 +4905,7 @@
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"dependencies": { "dependencies": {
"wrappy": "1" "wrappy": "1"
} }
@ -5011,6 +5004,7 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@ -5339,6 +5333,7 @@
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"dependencies": { "dependencies": {
"glob": "^7.1.3" "glob": "^7.1.3"
}, },
@ -5353,6 +5348,7 @@
"version": "7.2.3", "version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": { "dependencies": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
"inflight": "^1.0.4", "inflight": "^1.0.4",
@ -5467,6 +5463,11 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/siginfo": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
"integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="
},
"node_modules/signal-exit": { "node_modules/signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
@ -5540,6 +5541,11 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/stackback": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
"integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="
},
"node_modules/string-length": { "node_modules/string-length": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz",
@ -5710,22 +5716,6 @@
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
"dev": true "dev": true
}, },
"node_modules/tmp": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dependencies": {
"rimraf": "^3.0.0"
}
},
"node_modules/tmp-promise": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"dependencies": {
"tmp": "^0.2.0"
}
},
"node_modules/tmpl": { "node_modules/tmpl": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@ -6050,6 +6040,21 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/why-is-node-running": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz",
"integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==",
"dependencies": {
"siginfo": "^2.0.0",
"stackback": "0.0.2"
},
"bin": {
"why-is-node-running": "cli.js"
},
"engines": {
"node": ">=8"
}
},
"node_modules/word-wrap": { "node_modules/word-wrap": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@ -6076,7 +6081,8 @@
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
}, },
"node_modules/write-file-atomic": { "node_modules/write-file-atomic": {
"version": "4.0.2", "version": "4.0.2",
@ -6147,17 +6153,6 @@
} }
}, },
"dependencies": { "dependencies": {
"@actions/artifact": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.1.1.tgz",
"integrity": "sha512-Vv4y0EW0ptEkU+Pjs5RGS/0EryTvI6s79LjSV9Gg/h+O3H/ddpjhuX/Bi/HZE4pbNPyjGtQjbdFWphkZhmgabA==",
"requires": {
"@actions/core": "^1.9.1",
"@actions/http-client": "^2.0.1",
"tmp": "^0.2.1",
"tmp-promise": "^3.0.2"
}
},
"@actions/core": { "@actions/core": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
@ -8553,7 +8548,8 @@
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
}, },
"fsevents": { "fsevents": {
"version": "2.3.2", "version": "2.3.2",
@ -8825,6 +8821,7 @@
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": { "requires": {
"once": "^1.3.0", "once": "^1.3.0",
"wrappy": "1" "wrappy": "1"
@ -8833,7 +8830,8 @@
"inherits": { "inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
}, },
"internal-slot": { "internal-slot": {
"version": "1.0.4", "version": "1.0.4",
@ -9862,6 +9860,7 @@
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -9929,7 +9928,8 @@
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true
}, },
"path-key": { "path-key": {
"version": "3.1.1", "version": "3.1.1",
@ -10156,6 +10156,7 @@
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": { "requires": {
"glob": "^7.1.3" "glob": "^7.1.3"
}, },
@ -10164,6 +10165,7 @@
"version": "7.2.3", "version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"requires": { "requires": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
"inflight": "^1.0.4", "inflight": "^1.0.4",
@ -10245,6 +10247,11 @@
"object-inspect": "^1.9.0" "object-inspect": "^1.9.0"
} }
}, },
"siginfo": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
"integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="
},
"signal-exit": { "signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
@ -10308,6 +10315,11 @@
} }
} }
}, },
"stackback": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
"integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="
},
"string-length": { "string-length": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz",
@ -10440,22 +10452,6 @@
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
"dev": true "dev": true
}, },
"tmp": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"requires": {
"rimraf": "^3.0.0"
}
},
"tmp-promise": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"requires": {
"tmp": "^0.2.0"
}
},
"tmpl": { "tmpl": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@ -10685,6 +10681,15 @@
"is-typed-array": "^1.1.10" "is-typed-array": "^1.1.10"
} }
}, },
"why-is-node-running": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz",
"integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==",
"requires": {
"siginfo": "^2.0.0",
"stackback": "0.0.2"
}
},
"word-wrap": { "word-wrap": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@ -10705,7 +10710,8 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
}, },
"write-file-atomic": { "write-file-atomic": {
"version": "4.0.2", "version": "4.0.2",

View File

@ -1,7 +1,8 @@
import log from 'why-is-node-running'
import * as core from '../node_modules/@actions/core/' import * as core from '../node_modules/@actions/core/'
import { import artifact, {
UploadArtifactOptions, UploadArtifactOptions
create
} from '../node_modules/@actions/artifact/lib/artifact' } from '../node_modules/@actions/artifact/lib/artifact'
import {findFilesToUpload} from './search' import {findFilesToUpload} from './search'
import {getInputs} from './input-helper' import {getInputs} from './input-helper'
@ -40,7 +41,6 @@ async function run(): Promise<void> {
) )
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`) core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
const artifactClient = create()
const options: UploadArtifactOptions = {} const options: UploadArtifactOptions = {}
if (inputs.retentionDays) { if (inputs.retentionDays) {
options.retentionDays = inputs.retentionDays options.retentionDays = inputs.retentionDays
@ -50,26 +50,21 @@ async function run(): Promise<void> {
options.compressionLevel = inputs.compressionLevel options.compressionLevel = inputs.compressionLevel
} }
const uploadResponse = await artifactClient.uploadArtifact( const uploadResponse = await artifact.uploadArtifact(
inputs.artifactName, inputs.artifactName,
searchResult.filesToUpload, searchResult.filesToUpload,
searchResult.rootDirectory, searchResult.rootDirectory,
options options
) )
if (uploadResponse.success === false) { core.info(
core.setFailed( `Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
`An error was encountered when uploading ${inputs.artifactName}.` )
) core.setOutput('artifact-id', uploadResponse.id)
} else {
core.info(
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
)
core.setOutput('artifact-id', uploadResponse.id)
}
} }
} catch (error) { } catch (error) {
core.setFailed((error as Error).message) core.setFailed((error as Error).message)
log()
} }
} }