Upload much more data in status reports
This commit is contained in:
parent
9769e4a6df
commit
87758a1402
33 changed files with 537 additions and 339 deletions
|
|
@ -4,9 +4,40 @@ import { getCodeQL } from './codeql';
|
|||
import * as sharedEnv from './shared-environment';
|
||||
import * as util from './util';
|
||||
|
||||
interface AutobuildStatusReport extends util.StatusReportBase {
|
||||
// Comma-separated set of languages being autobuilt
|
||||
autobuild_languages: string;
|
||||
// Language that failed autobuilding (or undefined if all languages succeeded).
|
||||
autobuild_failure?: string;
|
||||
}
|
||||
|
||||
async function sendCompletedStatusReport(
|
||||
startedAt: Date,
|
||||
allLanguages: string[],
|
||||
failingLanguage?: string,
|
||||
cause?: Error) {
|
||||
|
||||
const status = failingLanguage !== undefined || cause !== undefined ? 'failure' : 'success';
|
||||
const statusReportBase = await util.createStatusReportBase(
|
||||
'autobuild',
|
||||
status,
|
||||
startedAt,
|
||||
cause?.message,
|
||||
cause?.stack);
|
||||
const statusReport: AutobuildStatusReport = {
|
||||
...statusReportBase,
|
||||
autobuild_languages: allLanguages.join(','),
|
||||
autobuild_failure: failingLanguage,
|
||||
};
|
||||
await util.sendStatusReport(statusReport);
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const startedAt = new Date();
|
||||
let language;
|
||||
try {
|
||||
if (util.should_abort('autobuild', true) || !await util.reportActionStarting('autobuild')) {
|
||||
if (util.should_abort('autobuild', true) ||
|
||||
!await util.sendStatusReport(await util.createStatusReportBase('autobuild', 'starting', startedAt), true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -15,7 +46,7 @@ async function run() {
|
|||
// The languages are sorted in order specified by user or by lines of code if we got
|
||||
// them from the GitHub API, so try to build the first language on the list.
|
||||
const autobuildLanguages = process.env[sharedEnv.CODEQL_ACTION_TRACED_LANGUAGES]?.split(',') || [];
|
||||
const language = autobuildLanguages[0];
|
||||
language = autobuildLanguages[0];
|
||||
|
||||
if (!language) {
|
||||
core.info("None of the languages in this project require extra build steps");
|
||||
|
|
@ -36,11 +67,11 @@ async function run() {
|
|||
|
||||
} catch (error) {
|
||||
core.setFailed("We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. " + error.message);
|
||||
await util.reportActionFailed('autobuild', error.message, error.stack);
|
||||
await sendCompletedStatusReport(startedAt, [language], language, error);
|
||||
return;
|
||||
}
|
||||
|
||||
await util.reportActionSucceeded('autobuild');
|
||||
await sendCompletedStatusReport(startedAt, [language]);
|
||||
}
|
||||
|
||||
run().catch(e => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue