Merge pull request #32 from github/codeql-download-failure
provide a better error when codeql fails to download
This commit is contained in:
commit
27cc8b23fe
2 changed files with 28 additions and 16 deletions
22
lib/setup-tools.js
generated
22
lib/setup-tools.js
generated
|
|
@ -37,15 +37,21 @@ 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 });
|
||||||
let codeqlFolder = toolcache.find('CodeQL', version);
|
try {
|
||||||
if (codeqlFolder) {
|
let codeqlFolder = toolcache.find('CodeQL', version);
|
||||||
core.debug(`CodeQL found in cache ${codeqlFolder}`);
|
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'));
|
||||||
}
|
}
|
||||||
else {
|
catch (e) {
|
||||||
const codeqlPath = await toolcache.downloadTool(codeqlURL);
|
core.error(e);
|
||||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
|
throw new Error("Unable to download and extract CodeQL CLI");
|
||||||
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
|
|
||||||
}
|
}
|
||||||
return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));
|
|
||||||
}
|
}
|
||||||
exports.setupCodeQL = setupCodeQL;
|
exports.setupCodeQL = setupCodeQL;
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,19 @@ 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 });
|
||||||
|
|
||||||
let codeqlFolder = toolcache.find('CodeQL', version);
|
try {
|
||||||
if (codeqlFolder) {
|
let codeqlFolder = toolcache.find('CodeQL', version);
|
||||||
core.debug(`CodeQL found in cache ${codeqlFolder}`);
|
if (codeqlFolder) {
|
||||||
} else {
|
core.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||||
const codeqlPath = await toolcache.downloadTool(codeqlURL);
|
} else {
|
||||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
|
const codeqlPath = await toolcache.downloadTool(codeqlURL);
|
||||||
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
|
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'));
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue