Merge pull request #32 from github/codeql-download-failure

provide a better error when codeql fails to download
This commit is contained in:
Robert 2020-05-13 09:01:56 +01:00 committed by GitHub
commit 27cc8b23fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 16 deletions

6
lib/setup-tools.js generated
View file

@ -37,6 +37,7 @@ exports.CodeQLSetup = CodeQLSetup;
async function setupCodeQL() { async function setupCodeQL() {
const version = '1.0.0'; const version = '1.0.0';
const codeqlURL = core.getInput('tools', { required: true }); const codeqlURL = core.getInput('tools', { required: true });
try {
let codeqlFolder = toolcache.find('CodeQL', version); let codeqlFolder = toolcache.find('CodeQL', version);
if (codeqlFolder) { if (codeqlFolder) {
core.debug(`CodeQL found in cache ${codeqlFolder}`); core.debug(`CodeQL found in cache ${codeqlFolder}`);
@ -47,5 +48,10 @@ async function setupCodeQL() {
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version); codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
} }
return new CodeQLSetup(path.join(codeqlFolder, 'codeql')); return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));
}
catch (e) {
core.error(e);
throw new Error("Unable to download and extract CodeQL CLI");
}
} }
exports.setupCodeQL = setupCodeQL; exports.setupCodeQL = setupCodeQL;

View file

@ -32,6 +32,7 @@ export async function setupCodeQL(): Promise<CodeQLSetup> {
const version = '1.0.0'; const version = '1.0.0';
const codeqlURL = core.getInput('tools', { required: true }); const codeqlURL = core.getInput('tools', { required: true });
try {
let codeqlFolder = toolcache.find('CodeQL', version); let codeqlFolder = toolcache.find('CodeQL', version);
if (codeqlFolder) { if (codeqlFolder) {
core.debug(`CodeQL found in cache ${codeqlFolder}`); core.debug(`CodeQL found in cache ${codeqlFolder}`);
@ -41,4 +42,9 @@ export async function setupCodeQL(): Promise<CodeQLSetup> {
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version); codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
} }
return new CodeQLSetup(path.join(codeqlFolder, 'codeql')); return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));
} catch (e) {
core.error(e);
throw new Error("Unable to download and extract CodeQL CLI");
}
} }