MCPcopy Create free account
hub / github.com/github/awesome-copilot / buildMergedIntakeComment

Function buildMergedIntakeComment

eng/external-plugin-intake.mjs:509–557  ·  view source on GitHub ↗
(baseResult, qualityResult, runId, owner, repo)

Source from the content-addressed store, hash-verified

507}
508
509function buildMergedIntakeComment(baseResult, qualityResult, runId, owner, repo) {
510 if (!baseResult.valid) {
511 return baseResult.commentBody;
512 }
513
514 const marker = baseResult.commentMarker ?? EXTERNAL_PLUGIN_INTAKE_COMMENT_MARKER;
515 const qualitySection = buildQualityGatesCommentSection(qualityResult);
516 const runLink = runId && owner && repo ? `_[View workflow run](https://github.com/${owner}/${repo}/actions/runs/${runId})_` : "";
517
518 const intro =
519 qualityResult.failure_class === "submitter_fixes"
520 ? "## ⚠️ External plugin intake requires submitter fixes"
521 : qualityResult.failure_class === "infra"
522 ? "## ⚠️ External plugin intake could not complete quality checks"
523 : "## ✅ External plugin intake passed";
524
525 const statusLine =
526 qualityResult.failure_class === "submitter_fixes"
527 ? "This submission passed metadata validation, but quality gates found issues that must be fixed before it can move to maintainer review. Update the issue details or source plugin and then comment `/rerun-intake`."
528 : qualityResult.failure_class === "infra"
529 ? "This submission passed metadata validation, but the automated quality checks hit an infrastructure issue. A maintainer should rerun intake or use the explicit override command after review."
530 : "This submission passed automated intake validation and quality checks and is ready for maintainer review.";
531
532 return [
533 marker,
534 intro,
535 "",
536 statusLine,
537 "",
538 `- **Plugin:** ${baseResult.plugin?.name ?? "unknown"}`,
539 `- **Repository:** ${baseResult.plugin?.repository ?? "unknown"}`,
540 baseResult.plugin?.source?.ref ? `- **Ref:** [\`${baseResult.plugin.source.ref.replaceAll('\`', '\\\`')}\`](https://github.com/${encodeRepoPath(baseResult.plugin.source.repo)}/tree/${encodeURIComponent(baseResult.plugin.source.ref).replaceAll("%2F", "/")})` : undefined,
541 baseResult.plugin?.source?.sha ? `- **SHA:** [\`${baseResult.plugin.source.sha.replaceAll('\`', '\\\`')}\`](https://github.com/${encodeRepoPath(baseResult.plugin.source.repo)}/tree/${encodeURIComponent(baseResult.plugin.source.sha).replaceAll("%2F", "/")})` : undefined,
542 "",
543 qualitySection,
544 "",
545 "",
546 "### Canonical external.json payload",
547 "",
548 "",
549 "```json",
550 JSON.stringify(baseResult.plugin ?? {}, null, 2),
551 "```",
552 baseResult.warnings?.length
553 ? ["", "### Warnings", "", ...baseResult.warnings.map((warning) => `- ${warning}`)].join("\n")
554 : "",
555 runLink ? `\n${runLink}` : "",
556 ].join("\n");
557}
558
559export function applyQualityGateResult(baseEvaluation, qualityGateResult, runId, owner, repo) {
560 const baseResult = typeof baseEvaluation === "string" ? JSON.parse(baseEvaluation) : baseEvaluation;

Callers 1

applyQualityGateResultFunction · 0.85

Calls 2

encodeRepoPathFunction · 0.85

Tested by

no test coverage detected