-
Notifications
You must be signed in to change notification settings - Fork 17
72 lines (69 loc) · 3.02 KB
/
auto-pr-comment.yml
File metadata and controls
72 lines (69 loc) · 3.02 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Auto PR Comment
# Sequential: wait for first reviewer, then trigger Copilot
on:
issue_comment:
types: [created]
pull_request_review:
types: [submitted]
jobs:
copilot-after-coderabbit:
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.user.login == 'coderabbitai[bot]' &&
contains(github.event.comment.body, 'summary by coderabbit')
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Post Copilot review request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100
});
if (comments.data.some(c => c.body && c.body.includes('@copilot') && c.body.includes('thorough review'))) {
console.log('Copilot already triggered, skipping');
return;
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@copilot Do a thorough review of this PR. Read ALL existing reviewer comments first.\n\n1. **Bloat check**: Minimal and focused?\n2. **Security**: Hardcoded secrets, unsafe eval?\n3. **Performance**: Module-level heavy imports?\n4. **Tests**: Adequate coverage?\n5. **Code quality**: DRY, naming, error handling?'
})
copilot-after-qodo:
if: |
github.event_name == 'pull_request_review' &&
github.event.review.user.login == 'qodo-code-review[bot]'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Post Copilot review request (fallback)
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const issue_number = context.payload.pull_request?.number ?? context.issue?.number;
const comments = await github.rest.issues.listComments({
issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100
});
if (comments.data.some(c => c.body && c.body.includes('@copilot') && c.body.includes('thorough review'))) {
console.log('Copilot already triggered, skipping');
return;
}
await github.rest.issues.createComment({
issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@copilot Do a thorough review of this PR. Read ALL existing reviewer comments first.\n\n1. **Bloat check**: Minimal and focused?\n2. **Security**: Hardcoded secrets?\n3. **Performance**: Heavy imports?\n4. **Tests**: Coverage?\n5. **Code quality**: DRY, naming, errors?'
})