Skip to content

Commit

Permalink
Merge pull request #32 from github/codeql-download-failure
Browse files Browse the repository at this point in the history
provide a better error when codeql fails to download
  • Loading branch information
robertbrignull authored May 13, 2020
2 parents cd95d34 + 584df47 commit 27cc8b2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions lib/setup-tools.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions src/setup-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ export async function setupCodeQL(): Promise<CodeQLSetup> {
const version = '1.0.0';
const codeqlURL = core.getInput('tools', { required: true });

let codeqlFolder = toolcache.find('CodeQL', version);
if (codeqlFolder) {
core.debug(`CodeQL found in cache ${codeqlFolder}`);
} else {
const codeqlPath = await toolcache.downloadTool(codeqlURL);
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
try {
let codeqlFolder = toolcache.find('CodeQL', version);
if (codeqlFolder) {
core.debug(`CodeQL found in cache ${codeqlFolder}`);
} else {
const codeqlPath = await toolcache.downloadTool(codeqlURL);
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
}
return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));

} catch (e) {
core.error(e);
throw new Error("Unable to download and extract CodeQL CLI");
}
return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));
}

0 comments on commit 27cc8b2

Please sign in to comment.