@@ -10,6 +10,9 @@ import { getAllRuleNames } from '@/content-linter/lib/helpers/rule-utils'
1010// GitHub issue body size limit is ~65k characters, so we'll use 60k as a safe limit
1111const MAX_ISSUE_BODY_SIZE = 60000
1212
13+ // If the number of warnings exceeds this number, print a warning so we can give them attention
14+ const MAX_WARNINGS_BEFORE_ALERT = 20
15+
1316/**
1417 * Config that only applies to automated weekly reports.
1518 */
@@ -89,18 +92,27 @@ async function main() {
8992
9093 const parsedResults = JSON . parse ( lintResults )
9194
95+ // Keep track of warnings so we can print an alert when they exceed a manageable number
96+ let totalWarnings = 0
97+
9298 // Filter results based on reporting configuration
9399 const filteredResults : Record < string , LintFlaw [ ] > = { }
94100 for ( const [ file , flaws ] of Object . entries ( parsedResults ) ) {
95101 const filteredFlaws = ( flaws as LintFlaw [ ] ) . filter ( ( flaw ) => shouldIncludeInReport ( flaw ) )
96102
97103 // Only include files that have remaining flaws after filtering
98104 if ( filteredFlaws . length > 0 ) {
105+ totalWarnings += filteredFlaws . filter ( ( flaw ) => flaw . severity === 'warning' ) . length
99106 filteredResults [ file ] = filteredFlaws
100107 }
101108 }
102109 const totalFiles = Object . keys ( filteredResults ) . length
103- let reportBody = 'The following files have markdown lint issues that require attention:\n\n'
110+
111+ const showTooManyWarningsAlert = totalWarnings > MAX_WARNINGS_BEFORE_ALERT
112+ const tooManyWarningsAlertText = showTooManyWarningsAlert
113+ ? `**Alert**: ${ totalWarnings } warning-level issues have been found. These must be addressed ASAP so they do not continue to accumulate.\n\n`
114+ : ''
115+ let reportBody = `${ tooManyWarningsAlertText } The following files have markdown lint issues that require attention:\n\n`
104116 let filesIncluded = 0
105117 let truncated = false
106118
0 commit comments