Skip to content

Commit 04a2ae9

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

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

.github/action/src/gh.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import * as fs from "fs";
21
import * as path from "path";
3-
42
import * as core from "@actions/core";
5-
import * as toolcache from "@actions/tool-cache";
63
import * as toolrunner from "@actions/exec/lib/toolrunner";
74

85
export interface GHConfig {

.github/action/src/index.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,29 @@ export async function run(): Promise<void> {
3737
}
3838

3939
// download pack
40-
core.info(`Downloading CodeQL Actions pack '${codeql.pack}'`);
41-
//var pack_downloaded = await cql.downloadPack(codeql);
40+
// core.info(`Downloading CodeQL Actions pack '${codeql.pack}'`);
41+
// var pack_downloaded = await cql.downloadPack(codeql);
4242

43+
core.info(`Cloning CodeQL Actions pack into '${codeql.pack}'`);
4344
let pack_path = "/tmp/codeql-actions";
44-
var pack_downloaded = await gh.clonePackRepo(ghc, pack_path);
45-
await cql.installPack(codeql, pack_path);
46-
47-
if (pack_downloaded === false) {
48-
var action_path = path.resolve(path.join(__dirname, "..", "..", ".."));
49-
core.info(`Pack path: '${action_path}'`);
50-
codeql.pack = path.join(action_path, "ql", "src");
51-
core.info(`Codeql pack path: '${codeql.path}'`);
52-
53-
core.info(`Pack defaulting back to local pack: '${codeql.pack}'`);
54-
} else {
55-
core.info(`Pack downloaded '${codeql.pack}'`);
45+
var pack_cloned = await gh.clonePackRepo(ghc, pack_path);
46+
core.info(`Cloned CodeQL Actions pack into '${pack_path}'`);
47+
48+
if (pack_cloned === false) {
49+
throw new Error("Could not clone the actions ql pack");
5650
}
5751

52+
core.info(`Installing CodeQL Actions packs from '${pack_path}'`);
53+
var pack_installed = await cql.installPack(codeql, pack_path);
54+
55+
if (pack_installed === false) {
56+
throw new Error("Could not install the actions ql packs");
57+
}
58+
59+
core.info(`Pack path: '${pack_path}'`);
60+
codeql.pack = path.join(pack_path, "ql", "src");
61+
core.info(`Codeql Queries pack path: '${codeql.pack}'`);
62+
5863
core.info("Creating CodeQL database...");
5964
var database_path = await cql.codeqlDatabaseCreate(codeql);
6065

0 commit comments

Comments
 (0)