Merge branch 'master' into feat/allow-disable-annotation

This commit is contained in:
Mickaël Villers
2022-11-04 21:56:29 +01:00
committed by GitHub
7 changed files with 73 additions and 22 deletions

View File

@ -1,4 +1,5 @@
const moment = require('moment')
const { summary } = require('@actions/core/lib/summary');
const kicsLogo = "https://user-images.githubusercontent.com/74597872/143567454-f65ad285-00d8-4875-845d-568d2e67d868.png"
const severityOrder = ["HIGH", "MEDIUM", "LOW", "INFO", "TRACE"];
@ -158,6 +159,12 @@ async function postPRComment(results, repo, prNumber, octokit, commentWithQuerie
}
}
async function postJobSummary(results, commentWithQueries = false, excludedColumnsForCommentsWithQueries) {
const message = createComment(results, commentWithQueries, excludedColumnsForCommentsWithQueries);
await summary.addRaw(message).write()
}
module.exports = {
postPRComment
postPRComment,
postJobSummary
};

View File

@ -49,6 +49,7 @@ async function main() {
const githubToken = process.env.INPUT_TOKEN;
const disableAnnotations = process.env.INPUT_DISABLE_ANNOTATIONS;
const enableComments = process.env.INPUT_ENABLE_COMMENTS;
const enableJobsSummary = process.env.INPUT_ENABLE_JOBS_SUMMARY;
const commentsWithQueries = process.env.INPUT_COMMENTS_WITH_QUERIES;
const excludedColumnsForCommentsWithQueries = process.env.INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES.split(',');
const outputPath = processOutputPath(process.env.INPUT_OUTPUT_PATH);
@ -78,6 +79,9 @@ async function main() {
if (enableComments.toLocaleLowerCase() === "true") {
await commenter.postPRComment(parsedResults, repo, prNumber, octokit, commentsWithQueries.toLocaleLowerCase() === "true", excludedColumnsForCommentsWithQueries);
}
if (enableJobsSummary.toLocaleLowerCase() === "true") {
await commenter.postJobSummary(parsedResults, commentsWithQueries.toLocaleLowerCase() === "true", excludedColumnsForCommentsWithQueries);
}
setWorkflowStatus(exitCode);
cleanupOutput(outputPath.resultsJSONFile, outputFormats);