1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Improves logic to account for Copilot being the PR author (#58582)

This commit is contained in:
Ben Ahmady
2025-11-24 15:09:01 +00:00
committed by GitHub
parent 8d31c642f6
commit 726258f09e

View File

@@ -45,17 +45,32 @@ jobs:
with:
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
script: |
// Get PR author username
const pr = context.payload.pull_request;
const prAuthor = pr.user.login;
const assignees = (pr.assignees ?? [])
.filter(a => a.login.toLowerCase() !== "copilot")
.map(a => "@" + a.login)
.join(" ");
// Compose the comment body as a plain text message to post on the PR
const commentBody =
"👋 @" + prAuthor +
" - Please leave us feedback on your contributing experience! " +
"To do this, please go to `#docs-contributor-feedback` on Slack.";
let commentBody;
if (assignees) {
commentBody =
"👋 " + assignees +
" - Please leave us feedback on your contributing experience! " +
"To do this, please go to `#docs-contributor-feedback` on Slack.";
} else if (prAuthor.toLowerCase() !== "copilot") {
commentBody =
"👋 @" + prAuthor +
" - Please leave us feedback on your contributing experience! " +
"To do this, please go to `#docs-contributor-feedback` on Slack.";
} else {
// nobody to mention!
commentBody =
"👋 Please leave us feedback on your contributing experience! " +
"To do this, please go to `#docs-contributor-feedback` on Slack.";
}
// Post the comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,