@@ -1163,31 +1163,7 @@ async def apply(self, recipe: Recipe) -> None:
1163
1163
# check if we already have an open PR (=> update in progress)
1164
1164
pullreqs = await self .ghub .get_prs (from_branch = branch_name , from_user = "bioconda" )
1165
1165
if pullreqs :
1166
- if len (pullreqs ) > 1 :
1167
- logger .error ("Multiple PRs updating %s: %s" ,
1168
- recipe ,
1169
- ", " .join (str (pull ['number' ]) for pull in pullreqs ))
1170
- for pull in pullreqs :
1171
- logger .debug ("Found PR %i updating %s: %s" ,
1172
- pull ["number" ], recipe , pull ["title" ])
1173
- # update the PR if title or body changed
1174
- pull = pullreqs [0 ]
1175
- if body == pull ["body" ]:
1176
- body = None
1177
- if title == pull ["title" ]:
1178
- title = None
1179
- if not (body is None and title is None ):
1180
- if await self .ghub .modify_issue (number = pull ['number' ], body = body , title = title ):
1181
- logger .info ("Updated PR %i updating %s to %s" ,
1182
- pull ['number' ], recipe , recipe .version )
1183
- else :
1184
- logger .error ("Failed to update PR %i with title=%s and body=%s" ,
1185
- pull ['number' ], title , body )
1186
- else :
1187
- logger .debug ("Not updating PR %i updating %s - no changes" ,
1188
- pull ['number' ], recipe )
1189
-
1190
- raise self .UpdateInProgress (recipe )
1166
+ title , body = await self ._handle_open_PRs (recipe , title , body , pullreqs )
1191
1167
1192
1168
# check for matching closed PR (=> update rejected)
1193
1169
pullreqs = await self .ghub .get_prs (from_branch = branch_name , state = self .ghub .STATE .closed )
@@ -1206,6 +1182,34 @@ async def apply(self, recipe: Recipe) -> None:
1206
1182
1207
1183
logger .info ("Created PR %i: %s" , pull ['number' ], title )
1208
1184
1185
+ async def _handle_open_PRs (self , recipe , title , body , pullreqs ):
1186
+ if len (pullreqs ) > 1 :
1187
+ logger .error ("Multiple PRs updating %s: %s" ,
1188
+ recipe ,
1189
+ ", " .join (str (pull ['number' ]) for pull in pullreqs ))
1190
+ for pull in pullreqs :
1191
+ logger .debug ("Found PR %i updating %s: %s" ,
1192
+ pull ["number" ], recipe , pull ["title" ])
1193
+ # update the PR if title or body changed
1194
+ pull = pullreqs [0 ]
1195
+ if body == pull ["body" ]:
1196
+ body = None
1197
+ if title == pull ["title" ]:
1198
+ title = None
1199
+ if not (body is None and title is None ):
1200
+ if await self .ghub .modify_issue (number = pull ['number' ], body = body , title = title ):
1201
+ logger .info ("Updated PR %i updating %s to %s" ,
1202
+ pull ['number' ], recipe , recipe .version )
1203
+ else :
1204
+ logger .error ("Failed to update PR %i with title=%s and body=%s" ,
1205
+ pull ['number' ], title , body )
1206
+ else :
1207
+ logger .debug ("Not updating PR %i updating %s - no changes" ,
1208
+ pull ['number' ], recipe )
1209
+
1210
+ raise self .UpdateInProgress (recipe )
1211
+ return title ,body
1212
+
1209
1213
1210
1214
class MaxUpdates (Filter ):
1211
1215
"""Terminate pipeline after **max_updates** recipes have been updated."""
0 commit comments