report action has aborted

This commit is contained in:
Alex Kalyvitis 2020-06-23 18:36:08 +02:00
parent 98f8945cfb
commit af252d2f0d
6 changed files with 50 additions and 15 deletions

View file

@ -139,20 +139,20 @@ function concatTracerConfigs(configs: { [lang: string]: TracerConfig }): TracerC
return { env, spec };
}
async function run() {
let languages: string[];
try {
if (util.should_abort('init', false) || !await util.reportActionStarting('init')) {
return;
}
// The config file MUST be parsed in the init action
const config = await configUtils.loadConfig();
core.startGroup('Load language configuration');
const languages = await util.getLanguages();
const config = await configUtils.loadConfig();
languages = await util.getLanguages();
// If the languages parameter was not given and no languages were
// detected then fail here as this is a workflow configuration error.
if (languages.length === 0) {
@ -160,10 +160,18 @@ async function run() {
return;
}
core.endGroup();
analysisPaths.includeAndExcludeAnalysisPaths(config, languages);
core.endGroup();
} catch (e) {
core.setFailed(e.message);
await util.reportActionAborted('init', e.message, );
return;
}
try {
const sourceRoot = path.resolve();
core.startGroup('Setup CodeQL tools');

View file

@ -365,6 +365,16 @@ export async function reportActionSucceeded(action: string) {
await sendStatusReport(await createStatusReport(action, 'success'));
}
/**
* Report that an action has been aborted.
*
* Note that the started_at date is always that of the `init` action, since
* this is likely to give a more useful duration when inspecting events.
*/
export async function reportActionAborted(action: string, cause?: string) {
await sendStatusReport(await createStatusReport(action, 'abort', cause));
}
/**
* Get the array of all the tool names contained in the given sarif contents.
*