@@ -77,27 +77,29 @@ def issue(
7777 status_description = 'has failing tests'
7878 else :
7979 status_description = 'no longer builds'
80+ request = json .dumps ({
81+ 'body' : maybe_delink (textwrap .dedent ('''\
82+ Hello, this is your friendly neighborhood mergebot.
83+ After merging PR {}, I observed that the tool {} {}.
84+ A follow-up PR to the repository {} is needed to fix the fallout.
85+
86+ cc @{}, do you think you would have time to do the follow-up work?
87+ If so, that would be great!
88+
89+ cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
90+
91+ ''' ).format (
92+ relevant_pr_number , tool , status_description ,
93+ REPOS .get (tool ), relevant_pr_user , pr_reviewer
94+ )),
95+ 'title' : '`{}` no longer builds after {}' .format (tool , relevant_pr_number ),
96+ 'assignees' : assignees ,
97+ 'labels' : ['T-compiler' , 'I-nominated' ],
98+ })
99+ print ("Creating issue:\n {}" .format (request ))
80100 response = urllib2 .urlopen (urllib2 .Request (
81101 gh_url (),
82- json .dumps ({
83- 'body' : maybe_delink (textwrap .dedent ('''\
84- Hello, this is your friendly neighborhood mergebot.
85- After merging PR {}, I observed that the tool {} {}.
86- A follow-up PR to the repository {} is needed to fix the fallout.
87-
88- cc @{}, do you think you would have time to do the follow-up work?
89- If so, that would be great!
90-
91- cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
92-
93- ''' ).format (
94- relevant_pr_number , tool , status_description ,
95- REPOS .get (tool ), relevant_pr_user , pr_reviewer
96- )),
97- 'title' : '`{}` no longer builds after {}' .format (tool , relevant_pr_number ),
98- 'assignees' : assignees ,
99- 'labels' : ['T-compiler' , 'I-nominated' ],
100- }),
102+ request ,
101103 {
102104 'Authorization' : 'token ' + github_token ,
103105 'Content-Type' : 'application/json' ,
@@ -135,13 +137,13 @@ def update_latest(
135137 for status in latest :
136138 tool = status ['tool' ]
137139 changed = False
138- create_issue = False
140+ create_issue_for_status = None # set to the status that caused the issue
139141
140142 for os , s in current_status .items ():
141143 old = status [os ]
142144 new = s .get (tool , old )
143145 status [os ] = new
144- if new > old :
146+ if new > old : # comparing the strings, but they are ordered appropriately!
145147 # things got fixed or at least the status quo improved
146148 changed = True
147149 message += '🎉 {} on {}: {} → {} (cc {}, @rust-lang/infra).\n ' \
@@ -156,20 +158,23 @@ def update_latest(
156158 # Most tools only create issues for build failures.
157159 # Other failures can be spurious.
158160 if new == 'build-fail' or (tool == 'miri' and new == 'test-fail' ):
159- create_issue = True
161+ create_issue_for_status = new
160162
161- if create_issue :
163+ if create_issue_for_status is not None :
162164 try :
163165 issue (
164- tool , new , MAINTAINERS .get (tool , '' ),
166+ tool , create_issue_for_status , MAINTAINERS .get (tool , '' ),
165167 relevant_pr_number , relevant_pr_user , pr_reviewer ,
166168 )
167- except IOError as e :
169+ except urllib2 . HTTPError as e :
168170 # network errors will simply end up not creating an issue, but that's better
169171 # than failing the entire build job
170- print ("I/O error: {0}" .format (e ))
172+ print ("HTTPError when creating issue for status regression: {0}\n {1}" .format (e , e .read ()))
173+ except IOError as e :
174+ print ("I/O error when creating issue for status regression: {0}" .format (e ))
171175 except :
172- print ("Unexpected error: {0}" .format (sys .exc_info ()[0 ]))
176+ print ("Unexpected error when creating issue for status regression: {0}"
177+ .format (sys .exc_info ()[0 ]))
173178 raise
174179
175180 if changed :
0 commit comments