34
34
'rust-by-example' : '@steveklabnik @marioidival @projektir' ,
35
35
}
36
36
37
+ REPOS = {
38
+ 'miri' : 'https://github.com/solson/miri' ,
39
+ 'clippy-driver' : 'https://github.com/rust-lang/rust-clippy' ,
40
+ 'rls' : 'https://github.com/rust-lang/rls' ,
41
+ 'rustfmt' : 'https://github.com/rust-lang/rustfmt' ,
42
+ 'book' : 'https://github.com/rust-lang/book' ,
43
+ 'nomicon' : 'https://github.com/rust-lang-nursery/nomicon' ,
44
+ 'reference' : 'https://github.com/rust-lang-nursery/reference' ,
45
+ 'rust-by-example' : 'https://github.com/rust-lang/rust-by-example' ,
46
+ }
47
+
37
48
38
49
def read_current_status (current_commit , path ):
39
50
'''Reads build status of `current_commit` from content of `history/*.tsv`
@@ -50,7 +61,7 @@ def issue(
50
61
maintainers ,
51
62
relevant_pr_number ,
52
63
relevant_pr_user ,
53
- msg ,
64
+ pr_reviewer ,
54
65
):
55
66
# Open an issue about the toolstate failure.
56
67
gh_url = 'https://api.github.com/repos/rust-lang/rust/issues'
@@ -60,15 +71,16 @@ def issue(
60
71
gh_url ,
61
72
json .dumps ({
62
73
'body' : '''\
63
- @{}: your PR ({}) broke {}
74
+ Hello, this is your friendly neighborhood mergebot.
75
+ After merging PR {}, I observed that the tool {} no longer builds.
76
+ A follow-up PR to the repository {} is needed to fix the fallout.
64
77
65
- If you have the time it would be great if you could open a PR against {} that
66
- fixes the fallout from your PR.
78
+ cc @{}, do you think you would have time to do the follow-up work? If so, that would be great!
67
79
68
- {}
80
+ cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
69
81
70
- ''' .format (relevant_pr_user , relevant_pr_number , tool , tool , msg ),
71
- 'title' : '💔 {}' .format (tool ),
82
+ ''' .format (relevant_pr_number , tool , REPOS [ tool ], relevant_pr_user , pr_reviewer ),
83
+ 'title' : '`{}` no longer builds after {}' .format (tool , relevant_pr_number ),
72
84
'assignees' : assignees ,
73
85
'labels' : ['T-compiler' , 'I-nominated' ],
74
86
}),
@@ -84,6 +96,7 @@ def update_latest(
84
96
relevant_pr_number ,
85
97
relevant_pr_url ,
86
98
relevant_pr_user ,
99
+ pr_reviewer ,
87
100
current_datetime
88
101
):
89
102
'''Updates `_data/latest.json` to match build result of the given commit.
@@ -108,7 +121,7 @@ def update_latest(
108
121
for status in latest :
109
122
tool = status ['tool' ]
110
123
changed = False
111
- failures = ''
124
+ build_failed = False
112
125
113
126
for os , s in current_status .items ():
114
127
old = status [os ]
@@ -128,11 +141,10 @@ def update_latest(
128
141
.format (title , MAINTAINERS .get (tool ))
129
142
# only create issues for build failures. Other failures can be spurious
130
143
if new == 'build-fail' :
131
- failures += title
132
- failures += '\n '
144
+ build_failed = True
133
145
134
- if failures != '' :
135
- issue (tool , MAINTAINERS .get (tool ), relevant_pr_number , relevant_pr_user , failures )
146
+ if build_failed :
147
+ issue (tool , MAINTAINERS .get (tool ), relevant_pr_number , relevant_pr_user , pr_reviewer )
136
148
137
149
if changed :
138
150
status ['commit' ] = current_commit
@@ -156,23 +168,26 @@ def update_latest(
156
168
github_token = sys .argv [4 ]
157
169
158
170
# assume that PR authors are also owners of the repo where the branch lives
159
- relevant_pr_match = re .search ('Auto merge of #([0-9]+) - ([^:]+)' , cur_commit_msg )
171
+ relevant_pr_match = re .search ('Auto merge of #([0-9]+) - ([^:]+):[^,]+ r=([^\s]+) ' , cur_commit_msg )
160
172
if relevant_pr_match :
161
173
number = relevant_pr_match .group (1 )
162
174
relevant_pr_user = relevant_pr_match .group (2 )
163
175
relevant_pr_number = 'rust-lang/rust#' + number
164
176
relevant_pr_url = 'https://github.com/rust-lang/rust/pull/' + number
177
+ pr_reviewer = relevant_pr_match .group (3 )
165
178
else :
166
179
number = '-1'
167
180
relevant_pr_user = '<unknown user>'
168
181
relevant_pr_number = '<unknown PR>'
169
182
relevant_pr_url = '<unknown>'
183
+ pr_reviewer = '<unknown reviewer>'
170
184
171
185
message = update_latest (
172
186
cur_commit ,
173
187
relevant_pr_number ,
174
188
relevant_pr_url ,
175
189
relevant_pr_user ,
190
+ pr_reviewer ,
176
191
cur_datetime
177
192
)
178
193
if not message :
0 commit comments