Skip to content

Commit da9d92e

Browse files
authored
Merge pull request #558 from bioconda/bioconda_bot
Bioconda bot
2 parents 37d91cf + 5fcfe03 commit da9d92e

20 files changed

+357
-261
lines changed

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
include bioconda_utils/bioconda_startup.sh
21
include bioconda_utils/bioconda_utils-requirements.txt
32
include bioconda_utils/bioconda_utils-conda_build_config.yaml
43
include bioconda_utils/config.schema.yaml
5-
include bioconda_utils/channel_order.txt
64
include bioconda_utils/templates/*
75
include bioconda_utils/maintainers.yaml
86
include versioneer.py

bioconda_utils/bioconda_startup.sh

Lines changed: 0 additions & 99 deletions
This file was deleted.

bioconda_utils/bot/events.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ async def handle_check_run(event, ghapi):
8989

9090
# Ignore check runs coming from other apps
9191
if event.get("check_run/app/id") != int(APP_ID):
92+
logger.info("Ignoring - event came from %s", app_owner)
9293
return
9394

9495
if action == "rerequested":

bioconda_utils/bot/tasks.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from .. import autobump
3737
from .. import hosters
3838
from ..recipe import Recipe
39-
from ..githandler import TempBiocondaRepo
39+
from ..githandler import TempBiocondaRepo, GitHandlerFailure
4040
from ..githubhandler import CheckRunStatus, CheckRunConclusion
4141
from ..circleci import AsyncCircleAPI
4242
from ..upload import anaconda_upload, skopeo_upload
@@ -121,7 +121,8 @@ async def __aenter__(self):
121121
else:
122122
branch = self.git.create_local_branch(branch_name, ref)
123123
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
125126
branch.checkout()
126127

127128
return self.git
@@ -316,7 +317,14 @@ async def lint_fix(head_branch: str, _head_sha: str, ghapi):
316317
linter.lint(recipes, fix=True)
317318

318319
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")
320328

321329

322330
@celery.task(acks_late=True)
@@ -550,8 +558,15 @@ async def merge_pr(self, pr_number: int, comment_id: int, ghapi) -> Tuple[bool,
550558
comment += "\n"
551559
await ghapi.update_comment(comment_id, comment)
552560

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+
555570

556571

557572
@celery.task(acks_late=True, ignore_result=True)
@@ -590,7 +605,7 @@ async def run_autobump(package_names, ghapi, *args):
590605
if not git:
591606
logger.error("failed to checkout master")
592607
return
593-
recipe_source = autobump.RecipeSource('recipes', package_names)
608+
recipe_source = autobump.RecipeSource('recipes', package_names, [])
594609
scanner = autobump.Scanner(recipe_source)
595610
scanner.add(autobump.ExcludeSubrecipe)
596611
scanner.add(autobump.GitLoadRecipe, git)

bioconda_utils/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from .build import build_recipes
2929
from . import docker_utils
3030
from . import lint
31-
from . import github_integration
3231
from . import bioconductor_skeleton as _bioconductor_skeleton
3332
from . import cran_skeleton
3433
from . import update_pinnings

bioconda_utils/draw_dag.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)