@@ -28596,7 +28596,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
28596
28596
return result;
28597
28597
};
28598
28598
Object.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;
28600
28600
const fs = __importStar(__nccwpck_require__(7147));
28601
28601
const path = __importStar(__nccwpck_require__(1017));
28602
28602
const core = __importStar(__nccwpck_require__(2186));
@@ -28675,18 +28675,6 @@ async function downloadPack(codeql) {
28675
28675
return false;
28676
28676
}
28677
28677
exports.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;
28690
28678
async function codeqlDatabaseCreate(codeql) {
28691
28679
// get runner temp directory for database
28692
28680
var temp = process.env["RUNNER_TEMP"];
@@ -28734,84 +28722,6 @@ async function codeqlDatabaseAnalyze(codeql, database_path) {
28734
28722
exports.codeqlDatabaseAnalyze = codeqlDatabaseAnalyze;
28735
28723
28736
28724
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
-
28815
28725
/***/ }),
28816
28726
28817
28727
/***/ 6144:
@@ -28847,17 +28757,12 @@ exports.run = void 0;
28847
28757
const path = __importStar(__nccwpck_require__(1017));
28848
28758
const core = __importStar(__nccwpck_require__(2186));
28849
28759
const cql = __importStar(__nccwpck_require__(950));
28850
- const gh = __importStar(__nccwpck_require__(1772));
28851
28760
/**
28852
28761
* The main function for the action.
28853
28762
* @returns {Promise<void>} Resolves when the action is complete.
28854
28763
*/
28855
28764
async function run() {
28856
28765
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"]);
28861
28766
// set up codeql
28862
28767
var codeql = await cql.newCodeQL();
28863
28768
core.debug(`CodeQL CLI found at '${codeql.path}'`);
@@ -28873,21 +28778,17 @@ async function run() {
28873
28778
core.setFailed("CodeQL Yaml extractor not installed");
28874
28779
throw new Error("CodeQL Yaml extractor not installed");
28875
28780
}
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
+ }
28891
28792
core.info("Creating CodeQL database...");
28892
28793
var database_path = await cql.codeqlDatabaseCreate(codeql);
28893
28794
core.info("Running CodeQL analysis...");
0 commit comments