fix: use correct API to invoke Copilot code review in doc-review workflow (#6918)

* Initial plan

* fix: use correct API to request Copilot code review in doc-review workflow

Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com>
Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>
pull/6917/head^2
Copilot 2026-03-10 12:22:58 -05:00 committed by GitHub
parent 507ec68cf7
commit 3952e3b65b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 4 deletions

View File

@ -89,11 +89,27 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'skip-review'))
steps:
- name: Request Copilot review
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
REPO: ${{ github.repository }}
run: gh pr edit "$PR_NUMBER" --repo "$REPO" --add-reviewer "copilot-reviews"
with:
script: |
const prNumber = context.issue.number || Number(process.env.PR_NUMBER);
try {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
reviewers: ['copilot-pull-request-reviewer'],
});
core.info('Copilot code review requested successfully');
} catch (error) {
core.warning(`Could not request Copilot review: ${error.message}`);
core.warning(
'To enable automatic Copilot reviews, configure a repository ruleset: ' +
'Settings → Rules → Rulesets → "Automatically request Copilot code review"'
);
}
# -----------------------------------------------------------------
# Job 3: Copilot visual review (depends on Job 1 for URLs)
@ -187,7 +203,7 @@ jobs:
'',
'---',
'',
`@copilot please review the preview pages listed above using the template below:`,
`@github-copilot please review the preview pages listed above using the template below:`,
'',
template.trim(),
'',