MCPcopy Create free account
hub / github.com/github/copilot-sdk / writeGitHubSummary

Function writeGitHubSummary

scripts/docs-validation/validate.ts:535–579  ·  view source on GitHub ↗
(
  summaryData: {
    language: string;
    passed: number;
    failed: number;
    failures: ValidationResult[];
  }[],
)

Source from the content-addressed store, hash-verified

533}
534
535function writeGitHubSummary(
536 summaryData: {
537 language: string;
538 passed: number;
539 failed: number;
540 failures: ValidationResult[];
541 }[],
542) {
543 const summaryFile = process.env.GITHUB_STEP_SUMMARY;
544 if (!summaryFile) return;
545
546 const totalPassed = summaryData.reduce((sum, d) => sum + d.passed, 0);
547 const totalFailed = summaryData.reduce((sum, d) => sum + d.failed, 0);
548 const allPassed = totalFailed === 0;
549
550 let summary = `## 📖 Documentation Validation Results\n\n`;
551
552 if (allPassed) {
553 summary += `✅ **All ${totalPassed} code blocks passed validation**\n\n`;
554 } else {
555 summary += `❌ **${totalFailed} failures** out of ${totalPassed + totalFailed} code blocks\n\n`;
556 }
557
558 summary += `| Language | Status | Passed | Failed |\n`;
559 summary += `|----------|--------|--------|--------|\n`;
560
561 for (const { language, passed, failed } of summaryData) {
562 const status = failed === 0 ? "✅" : "❌";
563 summary += `| ${language} | ${status} | ${passed} | ${failed} |\n`;
564 }
565
566 if (totalFailed > 0) {
567 summary += `\n### Failures\n\n`;
568 for (const { language, failures } of summaryData) {
569 if (failures.length === 0) continue;
570 summary += `#### ${language}\n\n`;
571 for (const f of failures) {
572 summary += `- **${f.sourceFile}:${f.sourceLine}**\n`;
573 summary += ` \`\`\`\n ${f.errors.slice(0, 3).join("\n ")}\n \`\`\`\n`;
574 }
575 }
576 }
577
578 fs.appendFileSync(summaryFile, summary);
579}
580
581async function main() {
582 const args = process.argv.slice(2);

Callers 1

mainFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…