-
Notifications
You must be signed in to change notification settings - Fork 17
69 lines (66 loc) · 2.89 KB
/
auto-pr-comment.yml
File metadata and controls
69 lines (66 loc) · 2.89 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
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.GITHUB_TOKEN }}
script: |
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
if (comments.data.some(c => c.user.login === 'github-actions[bot]' && c.body.includes('@copilot'))) {
console.log('Copilot already triggered, skipping');
return;
}
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.GITHUB_TOKEN }}
script: |
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
if (comments.data.some(c => c.user.login === 'github-actions[bot]' && c.body.includes('@copilot'))) {
console.log('Copilot already triggered, skipping');
return;
}
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?\n3. **Performance**: Heavy imports?\n4. **Tests**: Coverage?\n5. **Code quality**: DRY, naming, errors?'
})