Automatically collapse the scorecard table

This commit is contained in:
Justin Hutchings
2024-03-11 22:23:03 +00:00
parent b7fdb4c8e2
commit d186d663df
3 changed files with 13 additions and 1 deletions

6
dist/index.js generated vendored
View File

@@ -1314,6 +1314,9 @@ function snapshotWarningRecommendation(config, warnings) {
function addScorecardToSummary(scorecard, config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
core.summary.addHeading('OpenSSF Scorecard', 2);
if (scorecard.dependencies.length > 10) {
core.summary.addRaw(`<details><summary>Scorecard details</summary>`, true);
}
core.summary.addRaw(`<table><tr><th>Package</th><th>Version</th><th>Score</th><th>Details</th></tr>`, true);
for (const dependency of scorecard.dependencies) {
core.debug('Adding scorecard to summary');
@@ -1347,6 +1350,9 @@ function addScorecardToSummary(scorecard, config) {
}
}
core.summary.addRaw(`</table>`);
if (scorecard.dependencies.length > 10) {
core.summary.addRaw(`</details>`);
}
}
exports.addScorecardToSummary = addScorecardToSummary;
function addSnapshotWarnings(config, warnings) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -254,6 +254,9 @@ export function addScorecardToSummary(
config: ConfigurationOptions
): void {
core.summary.addHeading('OpenSSF Scorecard', 2)
if (scorecard.dependencies.length > 10) {
core.summary.addRaw(`<details><summary>Scorecard details</summary>`, true)
}
core.summary.addRaw(
`<table><tr><th>Package</th><th>Version</th><th>Score</th><th>Details</th></tr>`,
true
@@ -303,6 +306,9 @@ export function addScorecardToSummary(
}
}
core.summary.addRaw(`</table>`)
if (scorecard.dependencies.length > 10) {
core.summary.addRaw(`</details>`)
}
}
export function addSnapshotWarnings(