Skip to content

Commit 8fc4a0b

Browse files
committed
fixed summary checker
1 parent 1bd9abc commit 8fc4a0b

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

.github/workflows/pr-format-check.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,27 @@ jobs:
3232
core.setFailed(`❌ PR should contain a valid ADO Work Item ID.\nExpected a hyperlink in the format: https://sqlclientdrivers.visualstudio.com/.../_workitems/edit/<ID>\nPlease ensure the ADO task hyperlink is present in the PR description.`);
3333
}
3434
35-
// Check if PR description contains a non-empty summary section
35+
// Check if PR description contains a meaningful summary section with actual content
3636
const summaryPattern = /###\s*Summary\s*\r?\n([\s\S]*?)(\r?\n###|$)/;
3737
const summaryMatch = body.match(summaryPattern);
3838
39-
// If summary section exists, check if it has content (excluding comments and whitespace)
40-
const hasSummary = summaryMatch &&
41-
summaryMatch[1] &&
42-
summaryMatch[1].replace(/<!--[\s\S]*?-->/g, '').trim().length > 0;
43-
44-
if (!hasSummary) {
45-
core.setFailed(`❌ PR should contain a non-empty summary section. Please add a meaningful summary under the '### Summary' heading in your PR description.`);
39+
let hasValidSummary = false;
40+
41+
if (summaryMatch && summaryMatch[1]) {
42+
// Extract the summary content
43+
const summaryContent = summaryMatch[1];
44+
45+
// Remove all HTML comments including the template placeholder
46+
const contentWithoutComments = summaryContent.replace(/<!--[\s\S]*?-->/g, '');
47+
48+
// Remove whitespace and check if there's actual text content
49+
const trimmedContent = contentWithoutComments.trim();
50+
51+
// Check if there's at least 10 characters of meaningful content
52+
hasValidSummary = trimmedContent.length >= 10;
53+
}
54+
55+
if (!hasValidSummary) {
56+
core.setFailed(`❌ PR must contain a meaningful summary section with actual text content (minimum 10 characters).
57+
Please add a clear description under the '### Summary' heading in your PR description.`);
4658
}

0 commit comments

Comments
 (0)