mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 17:50:07 +08:00
* Bump the npm group with 11 updates Bumps the npm group with 11 updates: | Package | From | To | | --- | --- | --- | | [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) | `1.1.1` | `1.1.2` | | [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.0` | `1.10.1` | | [uuid](https://github.com/uuidjs/uuid) | `9.0.0` | `9.0.1` | | [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) | `9.0.3` | `9.0.4` | | [@types/adm-zip](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/adm-zip) | `0.5.0` | `0.5.1` | | [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/js-yaml) | `4.0.5` | `4.0.6` | | [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.5.1` | `7.5.2` | | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.5.0` | `6.7.2` | | [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.6.0` | `6.7.2` | | [eslint](https://github.com/eslint/eslint) | `8.48.0` | `8.49.0` | | [sinon](https://github.com/sinonjs/sinon) | `15.2.0` | `16.0.0` | Updates `@actions/artifact` from 1.1.1 to 1.1.2 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact) Updates `@actions/core` from 1.10.0 to 1.10.1 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Updates `uuid` from 9.0.0 to 9.0.1 - [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md) - [Commits](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1) Updates `@types/uuid` from 9.0.3 to 9.0.4 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid) Updates `@types/adm-zip` from 0.5.0 to 0.5.1 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/adm-zip) Updates `@types/js-yaml` from 4.0.5 to 4.0.6 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml) Updates `@types/semver` from 7.5.1 to 7.5.2 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) Updates `@typescript-eslint/eslint-plugin` from 6.5.0 to 6.7.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.2/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 6.6.0 to 6.7.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.2/packages/parser) Updates `eslint` from 8.48.0 to 8.49.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0) Updates `sinon` from 15.2.0 to 16.0.0 - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v15.2.0...v16.0.0) --- updated-dependencies: - dependency-name: "@actions/artifact" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@actions/core" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm - dependency-name: uuid dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@types/uuid" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@types/adm-zip" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@types/js-yaml" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@types/semver" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
182 lines
10 KiB
JavaScript
182 lines
10 KiB
JavaScript
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.DefaultArtifactClient = void 0;
|
|
const core = __importStar(require("@actions/core"));
|
|
const upload_specification_1 = require("./upload-specification");
|
|
const upload_http_client_1 = require("./upload-http-client");
|
|
const utils_1 = require("./utils");
|
|
const path_and_artifact_name_validation_1 = require("./path-and-artifact-name-validation");
|
|
const download_http_client_1 = require("./download-http-client");
|
|
const download_specification_1 = require("./download-specification");
|
|
const config_variables_1 = require("./config-variables");
|
|
const path_1 = require("path");
|
|
class DefaultArtifactClient {
|
|
/**
|
|
* Constructs a DefaultArtifactClient
|
|
*/
|
|
static create() {
|
|
return new DefaultArtifactClient();
|
|
}
|
|
/**
|
|
* Uploads an artifact
|
|
*/
|
|
uploadArtifact(name, files, rootDirectory, options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
core.info(`Starting artifact upload
|
|
For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging`);
|
|
(0, path_and_artifact_name_validation_1.checkArtifactName)(name);
|
|
// Get specification for the files being uploaded
|
|
const uploadSpecification = (0, upload_specification_1.getUploadSpecification)(name, rootDirectory, files);
|
|
const uploadResponse = {
|
|
artifactName: name,
|
|
artifactItems: [],
|
|
size: 0,
|
|
failedItems: []
|
|
};
|
|
const uploadHttpClient = new upload_http_client_1.UploadHttpClient();
|
|
if (uploadSpecification.length === 0) {
|
|
core.warning(`No files found that can be uploaded`);
|
|
}
|
|
else {
|
|
// Create an entry for the artifact in the file container
|
|
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');
|
|
}
|
|
core.debug(`Upload Resource URL: ${response.fileContainerResourceUrl}`);
|
|
core.info(`Container for artifact "${name}" successfully created. Starting upload of file(s)`);
|
|
// Upload each of the files that were found concurrently
|
|
const uploadResult = yield uploadHttpClient.uploadArtifactToFileContainer(response.fileContainerResourceUrl, uploadSpecification, options);
|
|
// Update the size of the artifact to indicate we are done uploading
|
|
// The uncompressed size is used for display when downloading a zip of the artifact from the UI
|
|
core.info(`File upload process has finished. Finalizing the artifact upload`);
|
|
yield uploadHttpClient.patchArtifactSize(uploadResult.totalSize, name);
|
|
if (uploadResult.failedItems.length > 0) {
|
|
core.info(`Upload finished. There were ${uploadResult.failedItems.length} items that failed to upload`);
|
|
}
|
|
else {
|
|
core.info(`Artifact has been finalized. All files have been successfully uploaded!`);
|
|
}
|
|
core.info(`
|
|
The raw size of all the files that were specified for upload is ${uploadResult.totalSize} bytes
|
|
The size of all the files that were uploaded is ${uploadResult.uploadSize} bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
|
|
|
|
Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads \r\n`);
|
|
uploadResponse.artifactItems = uploadSpecification.map(item => item.absoluteFilePath);
|
|
uploadResponse.size = uploadResult.uploadSize;
|
|
uploadResponse.failedItems = uploadResult.failedItems;
|
|
}
|
|
return uploadResponse;
|
|
});
|
|
}
|
|
downloadArtifact(name, path, options) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const downloadHttpClient = new download_http_client_1.DownloadHttpClient();
|
|
const artifacts = yield downloadHttpClient.listArtifacts();
|
|
if (artifacts.count === 0) {
|
|
throw new Error(`Unable to find any artifacts for the associated workflow`);
|
|
}
|
|
const artifactToDownload = artifacts.value.find(artifact => {
|
|
return artifact.name === name;
|
|
});
|
|
if (!artifactToDownload) {
|
|
throw new Error(`Unable to find an artifact with the name: ${name}`);
|
|
}
|
|
const items = yield downloadHttpClient.getContainerItems(artifactToDownload.name, artifactToDownload.fileContainerResourceUrl);
|
|
if (!path) {
|
|
path = (0, config_variables_1.getWorkSpaceDirectory)();
|
|
}
|
|
path = (0, path_1.normalize)(path);
|
|
path = (0, path_1.resolve)(path);
|
|
// During upload, empty directories are rejected by the remote server so there should be no artifacts that consist of only empty directories
|
|
const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(name, items.value, path, (options === null || options === void 0 ? void 0 : options.createArtifactFolder) || false);
|
|
if (downloadSpecification.filesToDownload.length === 0) {
|
|
core.info(`No downloadable files were found for the artifact: ${artifactToDownload.name}`);
|
|
}
|
|
else {
|
|
// Create all necessary directories recursively before starting any download
|
|
yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure);
|
|
core.info('Directory structure has been set up for the artifact');
|
|
yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate);
|
|
yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload);
|
|
}
|
|
return {
|
|
artifactName: name,
|
|
downloadPath: downloadSpecification.rootDownloadLocation
|
|
};
|
|
});
|
|
}
|
|
downloadAllArtifacts(path) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const downloadHttpClient = new download_http_client_1.DownloadHttpClient();
|
|
const response = [];
|
|
const artifacts = yield downloadHttpClient.listArtifacts();
|
|
if (artifacts.count === 0) {
|
|
core.info('Unable to find any artifacts for the associated workflow');
|
|
return response;
|
|
}
|
|
if (!path) {
|
|
path = (0, config_variables_1.getWorkSpaceDirectory)();
|
|
}
|
|
path = (0, path_1.normalize)(path);
|
|
path = (0, path_1.resolve)(path);
|
|
let downloadedArtifacts = 0;
|
|
while (downloadedArtifacts < artifacts.count) {
|
|
const currentArtifactToDownload = artifacts.value[downloadedArtifacts];
|
|
downloadedArtifacts += 1;
|
|
core.info(`starting download of artifact ${currentArtifactToDownload.name} : ${downloadedArtifacts}/${artifacts.count}`);
|
|
// Get container entries for the specific artifact
|
|
const items = yield downloadHttpClient.getContainerItems(currentArtifactToDownload.name, currentArtifactToDownload.fileContainerResourceUrl);
|
|
const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(currentArtifactToDownload.name, items.value, path, true);
|
|
if (downloadSpecification.filesToDownload.length === 0) {
|
|
core.info(`No downloadable files were found for any artifact ${currentArtifactToDownload.name}`);
|
|
}
|
|
else {
|
|
yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure);
|
|
yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate);
|
|
yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload);
|
|
}
|
|
response.push({
|
|
artifactName: currentArtifactToDownload.name,
|
|
downloadPath: downloadSpecification.rootDownloadLocation
|
|
});
|
|
}
|
|
return response;
|
|
});
|
|
}
|
|
}
|
|
exports.DefaultArtifactClient = DefaultArtifactClient;
|
|
//# sourceMappingURL=artifact-client.js.map
|