diff --git a/.github/action/src/gh.ts b/.github/action/src/gh.ts index a4e187053be..668e559e40b 100644 --- a/.github/action/src/gh.ts +++ b/.github/action/src/gh.ts @@ -1,8 +1,5 @@ -import * as fs from "fs"; import * as path from "path"; - import * as core from "@actions/core"; -import * as toolcache from "@actions/tool-cache"; import * as toolrunner from "@actions/exec/lib/toolrunner"; export interface GHConfig { diff --git a/.github/action/src/index.ts b/.github/action/src/index.ts index 24daf06f537..aea847298b4 100644 --- a/.github/action/src/index.ts +++ b/.github/action/src/index.ts @@ -37,24 +37,29 @@ export async function run(): Promise { } // download pack - core.info(`Downloading CodeQL Actions pack '${codeql.pack}'`); - //var pack_downloaded = await cql.downloadPack(codeql); + // core.info(`Downloading CodeQL Actions pack '${codeql.pack}'`); + // var pack_downloaded = await cql.downloadPack(codeql); + core.info(`Cloning CodeQL Actions pack into '${codeql.pack}'`); let pack_path = "/tmp/codeql-actions"; - var pack_downloaded = await gh.clonePackRepo(ghc, pack_path); - await cql.installPack(codeql, pack_path); + var pack_cloned = await gh.clonePackRepo(ghc, pack_path); + core.info(`Cloned CodeQL Actions pack into '${pack_path}'`); - if (pack_downloaded === false) { - var action_path = path.resolve(path.join(__dirname, "..", "..", "..")); - core.info(`Pack path: '${action_path}'`); - codeql.pack = path.join(action_path, "ql", "src"); - core.info(`Codeql pack path: '${codeql.path}'`); - - core.info(`Pack defaulting back to local pack: '${codeql.pack}'`); - } else { - core.info(`Pack downloaded '${codeql.pack}'`); + if (pack_cloned === false) { + throw new Error("Could not clone the actions ql pack"); } + core.info(`Installing CodeQL Actions packs from '${pack_path}'`); + var pack_installed = await cql.installPack(codeql, pack_path); + + if (pack_installed === false) { + throw new Error("Could not install the actions ql packs"); + } + + core.info(`Pack path: '${pack_path}'`); + codeql.pack = path.join(pack_path, "ql", "src"); + core.info(`Codeql Queries pack path: '${codeql.pack}'`); + core.info("Creating CodeQL database..."); var database_path = await cql.codeqlDatabaseCreate(codeql);