add truncation escape valve to new file summary to avoid overflow
This commit is contained in:
@@ -10,6 +10,8 @@ const icons = {
|
|||||||
warning: '⚠️'
|
warning: '⚠️'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAX_SCANNED_FILES_BYTES = 1048576
|
||||||
|
|
||||||
// generates the DR report summmary and caches it to the Action's core.summary.
|
// generates the DR report summmary and caches it to the Action's core.summary.
|
||||||
// returns the DR summary string, ready to be posted as a PR comment if the
|
// returns the DR summary string, ready to be posted as a PR comment if the
|
||||||
// final DR report is too large
|
// final DR report is too large
|
||||||
@@ -267,6 +269,21 @@ export function addScannedFiles(changes: Changes): void {
|
|||||||
const manifests = Array.from(
|
const manifests = Array.from(
|
||||||
groupDependenciesByManifest(changes).keys()
|
groupDependenciesByManifest(changes).keys()
|
||||||
).sort()
|
).sort()
|
||||||
|
|
||||||
|
let sf_size = 0
|
||||||
|
let trunc_at = -1
|
||||||
|
|
||||||
|
for (const [index, entry] of manifests.entries()) {
|
||||||
|
sf_size += entry.length
|
||||||
|
if (sf_size >= MAX_SCANNED_FILES_BYTES && trunc_at < 0) {
|
||||||
|
trunc_at = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trunc_at >= 0) {
|
||||||
|
manifests.slice(0, trunc_at)
|
||||||
|
}
|
||||||
|
|
||||||
core.summary.addHeading('Scanned Files', 2).addList(manifests)
|
core.summary.addHeading('Scanned Files', 2).addList(manifests)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user