diff --git a/emci/bot/bump_recipes_versions.py b/emci/bot/bump_recipes_versions.py index db8dfd73b..a8361ae55 100644 --- a/emci/bot/bump_recipes_versions.py +++ b/emci/bot/bump_recipes_versions.py @@ -110,8 +110,11 @@ def update_recipe_version(recipe_file, new_version, new_sha256, is_ratler): with open(recipe_file, 'w') as file: YAML().dump(recipe, file) -def make_pr_title(name, old_version, new_version): - return f"Update {name} from {old_version} to {new_version}" +def make_pr_title(name, old_version, new_version, target_pr_branch_name): + if target_pr_branch_name == "main": + return f"Update {name} from {old_version} to {new_version}" + else: + return f"Update {name} from {old_version} to {new_version} [{target_pr_branch_name}]" def bump_recipe_version(recipe_dir, target_pr_branch_name): @@ -151,6 +154,8 @@ def bump_recipe_version(recipe_dir, target_pr_branch_name): branch_name = f"bump-{name}_{current_version}_to_{new_version}" + if target_pr_branch_name != "main": + branch_name = f"{target_pr_branch_name}_{target_pr_branch_name}" with git_branch_ctx(branch_name, stash_current=False): @@ -163,7 +168,7 @@ def bump_recipe_version(recipe_dir, target_pr_branch_name): # commit the changes and make a PR pr_title = make_pr_title(name, current_version, new_version) - print(f"Making PR for {name} with title: {pr_title}") + print(f"Making PR for {name} with title: {pr_title} with target branch {target_pr_branch_name}") make_pr_for_recipe(recipe_dir=recipe_dir, pr_title=pr_title, branch_name=branch_name, target_branch_name=target_pr_branch_name, automerge=automerge) @@ -227,7 +232,7 @@ def user_ctx(user, email, bypass=False): def bump_recipe_versions(recipe_dir, pr_target_branch, use_bot=True, pr_limit=1): - + print(f"Bumping recipes in {recipe_dir} to {pr_target_branch}") # empty context manager @contextlib.contextmanager def empty_context_manager(): @@ -264,6 +269,7 @@ def empty_context_manager(): print("checkout done") assert get_current_branch_name() == pr_target_branch + current_branch_name = target_branch_name # Check for opened PRs and merge them if the CI passed print("Checking opened PRs and merge them if green!") @@ -311,7 +317,7 @@ def empty_context_manager(): total_bumped = 0 for recipe in all_recipes: try: - bumped_version, old_version, new_version = bump_recipe_version(recipe, current_branch_name) + bumped_version, old_version, new_version = bump_recipe_version(recipe, pr_target_branch) if bumped_version: print(f"Bumped {recipe} from {old_version} to {new_version}") total_bumped += int(bumped_version)