Improves logic to account for Copilot being the PR author (#58582)
This commit is contained in:
29
.github/workflows/feedback-prompt.yml
vendored
29
.github/workflows/feedback-prompt.yml
vendored
@@ -45,17 +45,32 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
||||||
script: |
|
script: |
|
||||||
// Get PR author username
|
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
const prAuthor = pr.user.login;
|
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
|
let commentBody;
|
||||||
const commentBody =
|
|
||||||
"👋 @" + prAuthor +
|
if (assignees) {
|
||||||
" - Please leave us feedback on your contributing experience! " +
|
commentBody =
|
||||||
"To do this, please go to `#docs-contributor-feedback` on Slack.";
|
"👋 " + 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({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
|
|||||||
Reference in New Issue
Block a user