-
Notifications
You must be signed in to change notification settings - Fork 8.6k
72 lines (67 loc) · 2.21 KB
/
reviewer-comment-router.yml
File metadata and controls
72 lines (67 loc) · 2.21 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: Reviewer Comment Router
on:
issue_comment:
types: [ created ]
pull_request_review_comment:
types: [ created ]
permissions:
contents: read
issues: read
pull-requests: read
jobs:
route:
name: Route reviewer comment
if: |
github.event.sender.type != 'Bot'
&& (
(
github.event_name == 'issue_comment'
&& github.event.issue.pull_request
&& !contains(github.event.issue.labels.*.name, 'reviewer:skip-ai')
&& (
(
contains(github.event.comment.body, '@codex')
&& contains(github.event.issue.labels.*.name, 'reviewer:codex')
)
|| (
contains(github.event.comment.body, '@claude')
&& contains(github.event.issue.labels.*.name, 'reviewer:claude')
)
)
)
|| (
github.event_name == 'pull_request_review_comment'
&& !contains(github.event.pull_request.labels.*.name, 'reviewer:skip-ai')
&& (
(
contains(github.event.comment.body, '@codex')
&& contains(github.event.pull_request.labels.*.name, 'reviewer:codex')
)
|| (
contains(github.event.comment.body, '@claude')
&& contains(github.event.pull_request.labels.*.name, 'reviewer:claude')
)
)
)
)
runs-on: ubuntu-slim
steps:
- name: Checkout workflow scripts
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: main
persist-credentials: false
- name: Validate reviewer comment
id: route
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
with:
script: |
const { routeReviewerComment } = require('./.github/scripts/reviewer_comment');
await routeReviewerComment({ context, core });
- name: Upload reviewer comment
if: steps.route.outputs.matched == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: reviewer-comment
path: reviewer-comment/comment.json
retention-days: 1