Format summary findings

This commit is contained in:
cnagadya
2022-10-27 15:41:19 +00:00
parent 72273c9a36
commit 4525a8c091
3 changed files with 23 additions and 17 deletions
Generated Vendored
+11 -7
View File
@@ -600,11 +600,15 @@ exports.addScannedDependencies = exports.addLicensesToSummary = exports.addChang
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const utils_1 = __nccwpck_require__(918); const utils_1 = __nccwpck_require__(918);
function addSummaryToSummary(addedPackages, invalidLicenseChanges) { function addSummaryToSummary(addedPackages, invalidLicenseChanges) {
core.summary.addHeading('Dependency Review').addRaw(`We found: core.summary
- ${addedPackages.length} vulnerable package(s),\n .addHeading('Dependency Review')
- ${invalidLicenseChanges.unresolved.length} package(s) with unprocessable licenses,\n .addRaw('We found:')
- ${invalidLicenseChanges.forbidden.length} package(s) with incompatible licenses, and\n .addList([
- ${invalidLicenseChanges.unlicensed.length} package(s) with unknown licenses.`); `${addedPackages.length} vulnerable package(s)`,
`${invalidLicenseChanges.unresolved.length} package(s) with unprocessable licenses`,
`${invalidLicenseChanges.forbidden.length} package(s) with incompatible licenses and`,
`${invalidLicenseChanges.unlicensed.length} package(s) with unknown licenses.`
]);
} }
exports.addSummaryToSummary = addSummaryToSummary; exports.addSummaryToSummary = addSummaryToSummary;
function addChangeVulnerabilitiesToSummary(addedPackages, severity) { function addChangeVulnerabilitiesToSummary(addedPackages, severity) {
@@ -685,7 +689,7 @@ function addLicensesToSummary(invalidLicenseChanges, config) {
} }
} }
else { else {
core.summary.addQuote('No license violations detected.'); core.summary.addQuote('No incompatible license detected.');
} }
core.debug(`found ${invalidLicenseChanges.unlicensed.length} unknown licenses`); core.debug(`found ${invalidLicenseChanges.unlicensed.length} unknown licenses`);
if (invalidLicenseChanges.unlicensed.length > 0) { if (invalidLicenseChanges.unlicensed.length > 0) {
@@ -711,7 +715,7 @@ function addScannedDependencies(changes) {
const manifests = dependencies.keys(); const manifests = dependencies.keys();
const summary = core.summary const summary = core.summary
.addHeading('Scanned Dependencies') .addHeading('Scanned Dependencies')
.addRaw(`We scanned ${dependencies.size} manifest files:`); .addHeading(`We scanned ${dependencies.size} manifest files:`, 'title');
for (const manifest of manifests) { for (const manifest of manifests) {
const deps = dependencies.get(manifest); const deps = dependencies.get(manifest);
if (deps) { if (deps) {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+11 -9
View File
@@ -7,13 +7,15 @@ export function addSummaryToSummary(
addedPackages: Changes, addedPackages: Changes,
invalidLicenseChanges: Record<string, Changes> invalidLicenseChanges: Record<string, Changes>
): void { ): void {
core.summary.addHeading('Dependency Review').addRaw( core.summary
`We found: .addHeading('Dependency Review')
- ${addedPackages.length} vulnerable package(s),\n .addRaw('We found:')
- ${invalidLicenseChanges.unresolved.length} package(s) with unprocessable licenses,\n .addList([
- ${invalidLicenseChanges.forbidden.length} package(s) with incompatible licenses, and\n `${addedPackages.length} vulnerable package(s)`,
- ${invalidLicenseChanges.unlicensed.length} package(s) with unknown licenses.` `${invalidLicenseChanges.unresolved.length} package(s) with unprocessable licenses`,
) `${invalidLicenseChanges.forbidden.length} package(s) with incompatible licenses and`,
`${invalidLicenseChanges.unlicensed.length} package(s) with unknown licenses.`
])
} }
export function addChangeVulnerabilitiesToSummary( export function addChangeVulnerabilitiesToSummary(
@@ -122,7 +124,7 @@ export function addLicensesToSummary(
core.summary.addTable([['Package', 'Version', 'License'], ...rows]) core.summary.addTable([['Package', 'Version', 'License'], ...rows])
} }
} else { } else {
core.summary.addQuote('No license violations detected.') core.summary.addQuote('No incompatible license detected.')
} }
core.debug( core.debug(
@@ -162,7 +164,7 @@ export function addScannedDependencies(changes: Changes): void {
const summary = core.summary const summary = core.summary
.addHeading('Scanned Dependencies') .addHeading('Scanned Dependencies')
.addRaw(`We scanned ${dependencies.size} manifest files:`) .addHeading(`We scanned ${dependencies.size} manifest files:`, 'title')
for (const manifest of manifests) { for (const manifest of manifests) {
const deps = dependencies.get(manifest) const deps = dependencies.get(manifest)