@@ -28596,7 +28596,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
2859628596 return result;
2859728597};
2859828598Object.defineProperty(exports, "__esModule", ({ value: true }));
28599- exports.codeqlDatabaseAnalyze = exports.codeqlDatabaseCreate = exports.installPack = exports. downloadPack = exports.runCommandJson = exports.runCommand = exports.newCodeQL = void 0;
28599+ exports.codeqlDatabaseAnalyze = exports.codeqlDatabaseCreate = exports.downloadPack = exports.runCommandJson = exports.runCommand = exports.newCodeQL = void 0;
2860028600const fs = __importStar(__nccwpck_require__(7147));
2860128601const path = __importStar(__nccwpck_require__(1017));
2860228602const core = __importStar(__nccwpck_require__(2186));
@@ -28675,18 +28675,6 @@ async function downloadPack(codeql) {
2867528675 return false;
2867628676}
2867728677exports.downloadPack = downloadPack;
28678- async function installPack(codeql, dir) {
28679- try {
28680- await runCommand(codeql, ["pack", "install"], path.join(dir, "/ql/lib"));
28681- await runCommand(codeql, ["pack", "install"], path.join(dir, "/ql/src"));
28682- return true;
28683- }
28684- catch (error) {
28685- core.warning("Failed to install local packs ...");
28686- }
28687- return false;
28688- }
28689- exports.installPack = installPack;
2869028678async function codeqlDatabaseCreate(codeql) {
2869128679 // get runner temp directory for database
2869228680 var temp = process.env["RUNNER_TEMP"];
@@ -28734,84 +28722,6 @@ async function codeqlDatabaseAnalyze(codeql, database_path) {
2873428722exports.codeqlDatabaseAnalyze = codeqlDatabaseAnalyze;
2873528723
2873628724
28737- /***/ }),
28738-
28739- /***/ 1772:
28740- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
28741-
28742- "use strict";
28743-
28744- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
28745- if (k2 === undefined) k2 = k;
28746- var desc = Object.getOwnPropertyDescriptor(m, k);
28747- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28748- desc = { enumerable: true, get: function() { return m[k]; } };
28749- }
28750- Object.defineProperty(o, k2, desc);
28751- }) : (function(o, m, k, k2) {
28752- if (k2 === undefined) k2 = k;
28753- o[k2] = m[k];
28754- }));
28755- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28756- Object.defineProperty(o, "default", { enumerable: true, value: v });
28757- }) : function(o, v) {
28758- o["default"] = v;
28759- });
28760- var __importStar = (this && this.__importStar) || function (mod) {
28761- if (mod && mod.__esModule) return mod;
28762- var result = {};
28763- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28764- __setModuleDefault(result, mod);
28765- return result;
28766- };
28767- Object.defineProperty(exports, "__esModule", ({ value: true }));
28768- exports.clonePackRepo = exports.runCommandJson = exports.runCommand = exports.newGHConfig = void 0;
28769- const path = __importStar(__nccwpck_require__(1017));
28770- const core = __importStar(__nccwpck_require__(2186));
28771- const toolrunner = __importStar(__nccwpck_require__(8159));
28772- async function newGHConfig() {
28773- return {
28774- path: "/usr/bin/",
28775- };
28776- }
28777- exports.newGHConfig = newGHConfig;
28778- async function runCommand(config, args) {
28779- var bin = path.join(config.path, "gh");
28780- let output = "";
28781- var options = {
28782- listeners: {
28783- stdout: (data) => {
28784- output += data.toString();
28785- },
28786- },
28787- };
28788- await new toolrunner.ToolRunner(bin, args, options).exec();
28789- core.debug(`Finished running command :: ${bin} ${args.join(" ")}`);
28790- return output.trim();
28791- }
28792- exports.runCommand = runCommand;
28793- async function runCommandJson(config, args) {
28794- return JSON.parse(await runCommand(config, args));
28795- }
28796- exports.runCommandJson = runCommandJson;
28797- async function clonePackRepo(gh, path) {
28798- try {
28799- await runCommand(gh, [
28800- "repo",
28801- "clone",
28802- "GitHubSecurityLab/codeql-actions",
28803- path,
28804- ]);
28805- return true;
28806- }
28807- catch (error) {
28808- core.warning("Failed to clone pack from GitHub...");
28809- }
28810- return false;
28811- }
28812- exports.clonePackRepo = clonePackRepo;
28813-
28814-
2881528725/***/ }),
2881628726
2881728727/***/ 6144:
@@ -28847,17 +28757,12 @@ exports.run = void 0;
2884728757const path = __importStar(__nccwpck_require__(1017));
2884828758const core = __importStar(__nccwpck_require__(2186));
2884928759const cql = __importStar(__nccwpck_require__(950));
28850- const gh = __importStar(__nccwpck_require__(1772));
2885128760/**
2885228761 * The main function for the action.
2885328762 * @returns {Promise<void>} Resolves when the action is complete.
2885428763 */
2885528764async function run() {
2885628765 try {
28857- // set up gh
28858- var ghc = await gh.newGHConfig();
28859- core.debug(`GH CLI found at '${ghc.path}'`);
28860- await gh.runCommand(ghc, ["version"]);
2886128766 // set up codeql
2886228767 var codeql = await cql.newCodeQL();
2886328768 core.debug(`CodeQL CLI found at '${codeql.path}'`);
@@ -28873,21 +28778,17 @@ async function run() {
2887328778 core.setFailed("CodeQL Yaml extractor not installed");
2887428779 throw new Error("CodeQL Yaml extractor not installed");
2887528780 }
28876- core.info(`Cloning CodeQL Actions pack into '${codeql.pack}'`);
28877- let pack_path = "/tmp/codeql-actions";
28878- var pack_cloned = await gh.clonePackRepo(ghc, pack_path);
28879- core.info(`Cloned CodeQL Actions pack into '${pack_path}'`);
28880- if (pack_cloned === false) {
28881- throw new Error("Could not clone the actions ql pack");
28882- }
28883- core.info(`Installing CodeQL Actions packs from '${pack_path}'`);
28884- var pack_installed = await cql.installPack(codeql, pack_path);
28885- if (pack_installed === false) {
28886- throw new Error("Could not install the actions ql packs");
28887- }
28888- core.info(`Pack path: '${pack_path}'`);
28889- codeql.pack = path.join(pack_path, "ql", "src");
28890- core.info(`Codeql Queries pack path: '${codeql.pack}'`);
28781+ // download pack
28782+ core.info(`Downloading CodeQL IaC pack '${codeql.pack}'`);
28783+ var pack_downloaded = await cql.downloadPack(codeql);
28784+ if (pack_downloaded === false) {
28785+ var action_path = path.resolve(path.join(__dirname, "..", "..", ".."));
28786+ codeql.pack = path.join(action_path, "ql", "src");
28787+ core.info(`Pack defaulting back to local pack: '${codeql.pack}'`);
28788+ }
28789+ else {
28790+ core.info(`Pack downloaded '${codeql.pack}'`);
28791+ }
2889128792 core.info("Creating CodeQL database...");
2889228793 var database_path = await cql.codeqlDatabaseCreate(codeql);
2889328794 core.info("Running CodeQL analysis...");
0 commit comments