Skip to content

Commit b11d8da

Browse files
author
Alvaro Muñoz
committed
fix(actions): ql pack installation
1 parent 04a2ae9 commit b11d8da

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

.github/action/dist/index.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28613,13 +28613,14 @@ async function newCodeQL() {
2861328613
};
2861428614
}
2861528615
exports.newCodeQL = newCodeQL;
28616-
async function runCommand(config, args, cwd) {
28616+
async function runCommand(config, args, cwd_arg) {
2861728617
var bin = path.join(config.path, "codeql");
2861828618
let output = "";
28619-
var _cwd = process.cwd();
28620-
if (cwd) {
28621-
_cwd = cwd;
28619+
var cwd = process.cwd();
28620+
if (cwd_arg) {
28621+
cwd = cwd_arg;
2862228622
}
28623+
core.info("Current working directory: " + cwd);
2862328624
var options = {
2862428625
cwd: cwd,
2862528626
listeners: {
@@ -28674,11 +28675,10 @@ async function downloadPack(codeql) {
2867428675
return false;
2867528676
}
2867628677
exports.downloadPack = downloadPack;
28677-
async function installPack(codeql, path) {
28678+
async function installPack(codeql, dir) {
2867828679
try {
28679-
await runCommand(codeql, ["pack", "install"], path);
28680-
await runCommand(codeql, ["pack", "install"], path);
28681-
core.info("Installed local packs ...");
28680+
await runCommand(codeql, ["pack", "install"], path.join(dir, "/ql/lib"));
28681+
await runCommand(codeql, ["pack", "install"], path.join(dir, "/ql/src"));
2868228682
return true;
2868328683
}
2868428684
catch (error) {
@@ -28771,7 +28771,7 @@ const core = __importStar(__nccwpck_require__(2186));
2877128771
const toolrunner = __importStar(__nccwpck_require__(8159));
2877228772
async function newGHConfig() {
2877328773
return {
28774-
path: "",
28774+
path: "/usr/bin/",
2877528775
};
2877628776
}
2877728777
exports.newGHConfig = newGHConfig;
@@ -28874,21 +28874,23 @@ async function run() {
2887428874
throw new Error("CodeQL Yaml extractor not installed");
2887528875
}
2887628876
// download pack
28877-
core.info(`Downloading CodeQL Actions pack '${codeql.pack}'`);
28878-
//var pack_downloaded = await cql.downloadPack(codeql);
28877+
// core.info(`Downloading CodeQL Actions pack '${codeql.pack}'`);
28878+
// var pack_downloaded = await cql.downloadPack(codeql);
28879+
core.info(`Cloning CodeQL Actions pack into '${codeql.pack}'`);
2887928880
let pack_path = "/tmp/codeql-actions";
28880-
var pack_downloaded = await gh.clonePackRepo(ghc, pack_path);
28881-
await cql.installPack(codeql, pack_path);
28882-
if (pack_downloaded === false) {
28883-
var action_path = path.resolve(path.join(__dirname, "..", "..", ".."));
28884-
core.info(`Pack path: '${action_path}'`);
28885-
codeql.pack = path.join(action_path, "ql", "src");
28886-
core.info(`Codeql pack path: '${codeql.path}'`);
28887-
core.info(`Pack defaulting back to local pack: '${codeql.pack}'`);
28888-
}
28889-
else {
28890-
core.info(`Pack downloaded '${codeql.pack}'`);
28891-
}
28881+
var pack_cloned = await gh.clonePackRepo(ghc, pack_path);
28882+
core.info(`Cloned CodeQL Actions pack into '${pack_path}'`);
28883+
if (pack_cloned === false) {
28884+
throw new Error("Could not clone the actions ql pack");
28885+
}
28886+
core.info(`Installing CodeQL Actions packs from '${pack_path}'`);
28887+
var pack_installed = await cql.installPack(codeql, pack_path);
28888+
if (pack_installed === false) {
28889+
throw new Error("Could not install the actions ql packs");
28890+
}
28891+
core.info(`Pack path: '${pack_path}'`);
28892+
codeql.pack = path.join(pack_path, "ql", "src");
28893+
core.info(`Codeql Queries pack path: '${codeql.pack}'`);
2889228894
core.info("Creating CodeQL database...");
2889328895
var database_path = await cql.codeqlDatabaseCreate(codeql);
2889428896
core.info("Running CodeQL analysis...");
@@ -30815,4 +30817,4 @@ module.exports = parseParams
3081530817
/******/ module.exports = __webpack_exports__;
3081630818
/******/
3081730819
/******/ })()
30818-
;
30820+
;

0 commit comments

Comments
 (0)