-
Notifications
You must be signed in to change notification settings - Fork 1
Fix sync review source blockers #1940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,20 @@ function labelNames(pull = {}) { | |
| : []; | ||
| } | ||
|
|
||
| function hasExplicitIssueReferencePrefix(value) { | ||
| const prefix = cleanString(value) | ||
| .replace(/[>_[\]()`*~]/g, ' ') | ||
| .replace(/\s+/g, ' '); | ||
|
|
||
| if (/\b(?:pr|pull\s+request)\s*[:#-]?\s*$/i.test(prefix)) { | ||
| return false; | ||
| } | ||
|
|
||
| return /\b(?:close[sd]?|closing|fix(?:e[sd])?|fixing|resolve[sd]?|resolving|relate[sd]?\s+to|refs?|references?|issue|source\s+issue|github\s+issue)\s*[:#-]?\s*$/i.test( | ||
| prefix | ||
| ); | ||
| } | ||
|
|
||
| function extractIssueNumberFromText(text) { | ||
| const value = String(text || ''); | ||
| for (const match of value.matchAll(/#([0-9]+)/g)) { | ||
|
|
@@ -124,6 +138,9 @@ function extractIssueNumberFromText(text) { | |
| if (/\b(?:run|attempt|step|job|check|version|v)\s*$/i.test(preceding)) { | ||
| continue; | ||
| } | ||
| if (!hasExplicitIssueReferencePrefix(value.slice(Math.max(0, match.index - 80), match.index))) { | ||
| continue; | ||
|
Comment on lines
+141
to
+142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Applying Useful? React with 👍 / 👎. |
||
| } | ||
| const parsed = Number.parseInt(match[1], 10); | ||
| if (!Number.isNaN(parsed)) { | ||
| return parsed; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,9 +140,14 @@ function buildCoverageMonitorSummary(options = {}) { | |
| const terminal = summarizeReport(readJsonReport(options.terminal_report, 'terminal-disposition')); | ||
| const botAuth = summarizeReport(readJsonReport(options.bot_auth_report, 'bot-comment-auth')); | ||
| const monitors = [terminal, botAuth]; | ||
| if (cleanString(options.pr_source_context_report)) { | ||
| const prSourceContextReportPath = cleanString(options.pr_source_context_report); | ||
| if ( | ||
| prSourceContextReportPath && | ||
| fs.existsSync(prSourceContextReportPath) && | ||
| fs.statSync(prSourceContextReportPath).isFile() | ||
| ) { | ||
|
Comment on lines
+143
to
+148
|
||
| monitors.push( | ||
| summarizeReport(readJsonReport(options.pr_source_context_report, 'pr-source-context')) | ||
| summarizeReport(readJsonReport(prSourceContextReportPath, 'pr-source-context')) | ||
| ); | ||
| } | ||
| const status = overallStatus(monitors); | ||
|
|
@@ -217,7 +222,7 @@ function parseArgs(argv = process.argv.slice(2)) { | |
| bot_auth_report: | ||
| process.env.COVERAGE_MONITOR_BOT_AUTH_JSON || 'bot-comment-auth-coverage-summary.json', | ||
| pr_source_context_report: | ||
| process.env.COVERAGE_MONITOR_PR_SOURCE_CONTEXT_JSON || 'pr-source-context-coverage.json', | ||
| process.env.COVERAGE_MONITOR_PR_SOURCE_CONTEXT_JSON || '', | ||
| output_json: | ||
| process.env.COVERAGE_MONITOR_SUMMARY_JSON || 'coverage-monitor-summary.json', | ||
| output_md: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs.statSync(prSourceContextReportPath)can throw (e.g., permission errors, broken symlinks, race betweenexistsSyncandstatSync), which would crash the summary step. Consider wrapping thestatSynccall in a try/catch (treat errors as “report missing”/skip) or avoid the pre-stat and letreadJsonReport()handle read errors safely.