Skip to content

Commit 147c9bb

Browse files
committed
Improved bot
1 parent 796ba56 commit 147c9bb

File tree

2 files changed

+119
-17
lines changed

2 files changed

+119
-17
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ indent_size = 2
1616
indent_style = space
1717
indent_size = 2
1818

19+
[*.yaml]
20+
indent_style = space
21+
indent_size = 2
22+
1923
[test/cases/parsing/bom/bomfile.{css,js}]
2024
charset = utf-8-bom
2125

open-bot.yaml

Lines changed: 115 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ rules:
1717
remove: "PR: CI-not-ok"
1818
comment:
1919
identifier: "ci-result"
20-
readd: true
2120
message: |-
2221
The most important CI builds succeeded. Great work so far.
2322
- filters:
@@ -31,13 +30,15 @@ rules:
3130
label:
3231
add: "PR: CI-not-ok"
3332
remove: "PR: CI-ok"
34-
comment:
33+
comment:
3534
identifier: "ci-result"
36-
readd: true
3735
message: |-
3836
@{{issue.user.login}} The most important CI builds failed. This way your PR can't be merged.
39-
37+
4038
Please take a look at the [CI results]({{status.target_url}}) and fix these issues.
39+
40+
41+
4142
# Add tests-needed label depending on codedov status
4243
# comment to point the user writing test cases
4344
# comment in case of success
@@ -62,7 +63,6 @@ rules:
6263
actions:
6364
comment:
6465
identifier: "tests-result"
65-
readd: true
6666
message: |-
6767
The minimum test ratio has been reached. Thanks!
6868
- filters:
@@ -75,14 +75,13 @@ rules:
7575
actions:
7676
label:
7777
add: "PR: tests-needed"
78-
comment:
78+
comment:
7979
identifier: "tests-result"
80-
readd: true
8180
message: |-
8281
It looks like this Pull Request doesn't include [enough test cases]({{status.target_url}}).
83-
82+
8483
@{{issue.user.login}} Please add more test cases.
85-
84+
8685
See [test readme](https://github.com/webpack/webpack/blob/master/test/README.md) for details how to write test cases.
8786
8887
@@ -96,12 +95,32 @@ rules:
9695
commit: true
9796
review:
9897
state: APPROVED|CHANGES_REQUESTED
98+
ensure:
99+
value: "{{review.state}}"
100+
equals: APPROVED
99101
actions:
100102
label:
101-
add: "PR: reviewed"
103+
add: "PR: reviewed-approved"
102104
remove:
103105
- "PR: review-outdated"
104106
- "PR: unreviewed"
107+
- "PR: reviewed"
108+
- filters:
109+
open: true
110+
in_order:
111+
commit: true
112+
review:
113+
state: APPROVED|CHANGES_REQUESTED
114+
ensure:
115+
value: "{{review.state}}"
116+
equals: CHANGES_REQUESTED
117+
actions:
118+
label:
119+
add: "PR: reviewed-changes-requested"
120+
remove:
121+
- "PR: review-outdated"
122+
- "PR: unreviewed"
123+
- "PR: reviewed"
105124
- filters:
106125
open: true
107126
in_order:
@@ -112,16 +131,17 @@ rules:
112131
label:
113132
add: "PR: review-outdated"
114133
remove:
115-
- "PR: reviewed"
134+
- "PR: reviewed-approved"
135+
- "PR: reviewed-changes-requested"
116136
- "PR: unreviewed"
137+
- "PR: reviewed"
117138
comment:
118139
identifier: "review-outdated"
119-
readd: true
120140
message: |-
121-
@{{commit.committer.login}} Thanks for your update.
122-
141+
@{{commit.author.login}} Thanks for your update.
142+
123143
I labeled the Pull Request so reviewers will review it again.
124-
144+
125145
@{{review.user.login}} Please review the new changes.
126146
- filters:
127147
open: true
@@ -140,5 +160,83 @@ rules:
140160
age:
141161
maximum: 1w
142162
actions:
143-
comment: |-
144-
Thanks for your Pull Request. I labeled the Pull Request, so maintainers will review it.
163+
comment:
164+
identifier: "pr-thanks"
165+
message: |-
166+
Thanks for your Pull Request. I labeled the Pull Request, so maintainers will review it.
167+
168+
169+
170+
# add/remove mentioned-sokra label
171+
- filters:
172+
open: true
173+
any:
174+
in_order:
175+
comment_1:
176+
author: "^sokra$"
177+
comment_2: "@sokra"
178+
all:
179+
not:
180+
comment_1:
181+
author: "^sokra$"
182+
comment_2: "@sokra"
183+
actions:
184+
label: "mentioned-sokra"
185+
- filters:
186+
in_order:
187+
comment_1: "@sokra"
188+
comment_2:
189+
author: "^sokra$"
190+
actions:
191+
label:
192+
remove: "mentioned-sokra"
193+
194+
195+
196+
# add hot label for many comments
197+
- filters:
198+
open: true
199+
number_of_comments: 10
200+
actions:
201+
label: hot
202+
203+
204+
205+
# add non-master label to pull request to other branch
206+
- filters:
207+
pull_request:
208+
base_ref: "^(?!master)"
209+
actions:
210+
label: "PR: non-master"
211+
212+
213+
214+
# add non-master label to pull request to other branch
215+
- filters:
216+
pull_request:
217+
head_ref: "^master$"
218+
actions:
219+
comment:
220+
identifier: "head-master"
221+
edit: true
222+
message: |-
223+
Hi @{{pull_request.user.login}}.
224+
225+
First thanks for your pull request.
226+
227+
Just a little hint from a friendly bot about the best practice when submitting pull request:
228+
229+
> Don't submit pull request from your own `master` branch. It's recommended to create a feature branch for the PR.
230+
231+
*You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.*
232+
233+
234+
235+
# add small label to small pull requests
236+
- filters:
237+
pull_request:
238+
additions: "<= 10"
239+
deletions: "<= 10"
240+
changed_files: "<= 2"
241+
actions:
242+
label: "PR: small"

0 commit comments

Comments
 (0)