diff --git a/.github/workflows/maintainer-approval.js b/.github/workflows/maintainer-approval.js index daba81e106c..0f0272e898a 100644 --- a/.github/workflows/maintainer-approval.js +++ b/.github/workflows/maintainer-approval.js @@ -96,7 +96,7 @@ async function checkPerPathApproval(files, rulesWithTeams, approverLogins, githu // --- Git history & scoring helpers --- -const MENTION_REVIEWERS = true; +const MENTION_REVIEWERS = false; const OWNERS_LINK = "[OWNERS](.github/OWNERS)"; const MARKER = ""; const STATUS_CONTEXT = "maintainer-approval"; @@ -203,9 +203,8 @@ function topDirs(ds, n = 3) { } function fmtReviewer(login, dirs) { - const mention = MENTION_REVIEWERS ? `@${login}` : login; const dirList = dirs.map((d) => `\`${d}/\``).join(", "); - return `- ${mention} -- recent work in ${dirList}`; + return `- ${fmtLogin(login)} -- recent work in ${dirList}`; } function selectReviewers(ss) { @@ -221,8 +220,12 @@ function selectReviewers(ss) { } function fmtEligible(owners) { - if (MENTION_REVIEWERS) return owners.map((o) => `@${o}`).join(", "); - return owners.join(", "); + return owners.map((o) => fmtLogin(o)).join(", "); +} + +function fmtLogin(login) { + if (MENTION_REVIEWERS) return `@${login}`; + return `\`@${login}\``; } async function countRecentReviews(github, owner, repo, logins, days = 30) { @@ -267,7 +270,7 @@ function buildPendingPerGroupComment(groups, scores, dirScores, approvedBy, main const approver = approvedBy.get(pattern); if (approver) { - lines.push(`### \`${pattern}\` - approved by @${approver}`); + lines.push(`### \`${pattern}\` - approved by ${fmtLogin(approver)}`); } else { lines.push(`### \`${pattern}\` - needs approval`); } @@ -277,13 +280,13 @@ function buildPendingPerGroupComment(groups, scores, dirScores, approvedBy, main const individuals = owners.filter(o => !o.includes("/") && o.toLowerCase() !== authorLower); if (teams.length > 0) { - lines.push(`Teams: ${teams.map(t => `@${t}`).join(", ")}`); + lines.push(`Teams: ${teams.map(t => fmtLogin(t)).join(", ")}`); } if (!approver && individuals.length > 0) { const scored = individuals.map(o => [o, scores[o] || 0]).sort((a, b) => b[1] - a[1]); if (scored[0][1] > 0) { - lines.push(`Suggested: @${scored[0][0]}`); + lines.push(`Suggested: ${fmtLogin(scored[0][0])}`); const rest = scored.slice(1).map(([o]) => o); if (rest.length > 0) { lines.push(`Also eligible: ${fmtEligible(rest)}`); @@ -320,7 +323,7 @@ function buildPendingPerGroupComment(groups, scores, dirScores, approvedBy, main const maintainerList = maintainers .filter(m => m.toLowerCase() !== authorLower) - .map(m => `@${m}`) + .map(m => fmtLogin(m)) .join(", "); lines.push( @@ -349,7 +352,7 @@ function buildSingleDomainPendingComment(sortedScores, dirScores, scoredCount, e } else if (roundRobinReviewer) { lines.push( "Could not determine reviewers from git history.", - `Round-robin suggestion: @${roundRobinReviewer}`, + `Round-robin suggestion: ${fmtLogin(roundRobinReviewer)}`, "" ); } diff --git a/.github/workflows/maintainer-approval.test.js b/.github/workflows/maintainer-approval.test.js index 482b60dc380..c5d44f5dad6 100644 --- a/.github/workflows/maintainer-approval.test.js +++ b/.github/workflows/maintainer-approval.test.js @@ -509,7 +509,7 @@ describe("maintainer-approval", () => { assert.ok(body.includes("## Approval status: pending")); assert.ok(body.includes("`/cmd/pipelines/`")); assert.ok(body.includes("`/bundle/`")); - assert.ok(body.includes("approved by @jefferycheng1")); + assert.ok(body.includes("approved by `@jefferycheng1`")); assert.ok(body.includes("needs approval")); }); });