forked from kptdev/porch
-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (51 loc) · 2.04 KB
/
Copy pathcopilot-review.yaml
File metadata and controls
57 lines (51 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 2026 The kpt Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Request Copilot review when a PR is opened, reopened, or marked ready for review (non-draft).
# Further reviews can be requested manually via the GitHub UI.
#
# Prerequisite: Disable automatic Copilot code review in repo settings
# (Settings → Copilot → Code review → Disable automatic reviews)
name: Copilot Code Review
on:
pull_request_target:
types: [opened, ready_for_review, reopened]
permissions: {}
jobs:
request-copilot-review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Request Copilot review
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const prNumber = context.payload.pull_request.number;
core.info(`Requesting Copilot review for PR #${prNumber}`);
try {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
reviewers: ['copilot-pull-request-reviewer[bot]'],
});
core.info(`✅ Copilot review requested for PR #${prNumber}`);
} catch (error) {
if (error.status === 422) {
core.info(`Copilot review already requested or cannot be requested: ${error.message}`);
} else {
throw error;
}
}