Skip to content

Commit 375d9fb

Browse files
lpcoxCopilot
andcommitted
fix(ci-gate): add copilot-pull-request-reviewer[bot] and debug logging
The Reviews API returns the bot login with [bot] suffix, but the Set only contained the bare login. Also: - Add 'opened' to pull_request types so gate runs on PR creation - Add debug logging (event name, review logins) for troubleshooting Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b0e3c61 commit 375d9fb

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/ci-gate.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request_review:
1111
types: [submitted]
1212
pull_request:
13-
types: [synchronize] # push to PR branch
13+
types: [opened, synchronize] # new PR or push to PR branch
1414

1515
permissions:
1616
issues: write
@@ -25,12 +25,14 @@ jobs:
2525
uses: actions/github-script@v7
2626
with:
2727
script: |
28-
const copilotReviewers = new Set(['copilot', 'copilot[bot]', 'Copilot', 'copilot-pull-request-reviewer']);
28+
const copilotReviewers = new Set(['copilot', 'copilot[bot]', 'Copilot', 'copilot-pull-request-reviewer', 'copilot-pull-request-reviewer[bot]']);
2929
const isCopilotReviewer = login => copilotReviewers.has(login ?? '');
3030
const { owner, repo } = context.repo;
3131
const pr_number = context.payload.pull_request?.number
3232
|| context.payload.review?.pull_request?.number;
3333
34+
core.info(`Event: ${context.eventName}, PR: ${pr_number || 'none'}`);
35+
3436
if (!pr_number) {
3537
core.info('No PR number found, skipping');
3638
return;
@@ -45,25 +47,30 @@ jobs:
4547
return;
4648
}
4749
48-
// For synchronize events (push after review), add label if review exists
50+
// For synchronize/opened events (push after review), add label if review exists
4951
if (context.eventName === 'pull_request') {
5052
const { data: reviews } = await github.rest.pulls.listReviews({
5153
owner, repo, pull_number: pr_number
5254
});
55+
const reviewLogins = reviews.map(r => r.user?.login);
56+
core.info(`Found ${reviews.length} review(s): ${reviewLogins.join(', ')}`);
5357
const hasCopilotReview = reviews.some(r => isCopilotReviewer(r.user?.login));
5458
if (hasCopilotReview) {
5559
core.info('Post-review push detected, adding ready-for-ci label');
5660
await github.rest.issues.addLabels({
5761
owner, repo, issue_number: pr_number,
5862
labels: ['ready-for-ci']
5963
});
64+
} else {
65+
core.info('No Copilot review found yet, waiting');
6066
}
6167
return;
6268
}
6369
6470
// For review events, check if review has actionable comments
6571
if (context.eventName === 'pull_request_review') {
6672
const reviewer = context.payload.review?.user?.login;
73+
core.info(`Review event from: ${reviewer}`);
6774
if (!isCopilotReviewer(reviewer)) {
6875
core.info(`Review from ${reviewer}, not Copilot — skipping`);
6976
return;

0 commit comments

Comments
 (0)