|
36 | 36 | from .. import autobump
|
37 | 37 | from .. import hosters
|
38 | 38 | from ..recipe import Recipe
|
39 |
| -from ..githandler import TempBiocondaRepo |
| 39 | +from ..githandler import TempBiocondaRepo, GitHandlerFailure |
40 | 40 | from ..githubhandler import CheckRunStatus, CheckRunConclusion
|
41 | 41 | from ..circleci import AsyncCircleAPI
|
42 | 42 | from ..upload import anaconda_upload, skopeo_upload
|
@@ -121,7 +121,8 @@ async def __aenter__(self):
|
121 | 121 | else:
|
122 | 122 | branch = self.git.create_local_branch(branch_name, ref)
|
123 | 123 | if not branch:
|
124 |
| - raise RuntimeError(f"Failed to find {branch_name}:{ref} in {self.git}") |
| 124 | + logger.error(f"Failed to find {branch_name}:{ref} in {self.git}") |
| 125 | + return None |
125 | 126 | branch.checkout()
|
126 | 127 |
|
127 | 128 | return self.git
|
@@ -316,7 +317,14 @@ async def lint_fix(head_branch: str, _head_sha: str, ghapi):
|
316 | 317 | linter.lint(recipes, fix=True)
|
317 | 318 |
|
318 | 319 | msg = "Fixed Lint Checks"
|
319 |
| - git.commit_and_push_changes(['recipes'], None, msg=msg, sign=True) |
| 320 | + logger.info("Files changed: %s", list(git.list_modified_files())) |
| 321 | + try: |
| 322 | + if git.commit_and_push_changes([], None, msg=msg, sign=True): |
| 323 | + logger.info("Created commit in %s", head_branch) |
| 324 | + else: |
| 325 | + logger.info("No changes to %s", head_branch) |
| 326 | + except GitHandlerFailure: |
| 327 | + logger.error("Push failed") |
320 | 328 |
|
321 | 329 |
|
322 | 330 | @celery.task(acks_late=True)
|
@@ -550,8 +558,15 @@ async def merge_pr(self, pr_number: int, comment_id: int, ghapi) -> Tuple[bool,
|
550 | 558 | comment += "\n"
|
551 | 559 | await ghapi.update_comment(comment_id, comment)
|
552 | 560 |
|
553 |
| - return await ghapi.merge_pr(pr_number, sha=last_sha, |
554 |
| - message="\n".join(lines) if lines else None) |
| 561 | + res, msg = await ghapi.merge_pr(pr_number, sha=last_sha, |
| 562 | + message="\n".join(lines) if lines else None) |
| 563 | + if not res: |
| 564 | + return res, msg |
| 565 | + |
| 566 | + if not branch.startswith('pull/'): |
| 567 | + await ghapi.delete_branch(branch) |
| 568 | + return res, msg |
| 569 | + |
555 | 570 |
|
556 | 571 |
|
557 | 572 | @celery.task(acks_late=True, ignore_result=True)
|
@@ -590,7 +605,7 @@ async def run_autobump(package_names, ghapi, *args):
|
590 | 605 | if not git:
|
591 | 606 | logger.error("failed to checkout master")
|
592 | 607 | return
|
593 |
| - recipe_source = autobump.RecipeSource('recipes', package_names) |
| 608 | + recipe_source = autobump.RecipeSource('recipes', package_names, []) |
594 | 609 | scanner = autobump.Scanner(recipe_source)
|
595 | 610 | scanner.add(autobump.ExcludeSubrecipe)
|
596 | 611 | scanner.add(autobump.GitLoadRecipe, git)
|
|
0 commit comments