From 0e3a236800d9ed6286a41e08541674f8816ae781 Mon Sep 17 00:00:00 2001 From: Leona Maroni Date: Mon, 9 Dec 2024 09:05:50 +0100 Subject: [PATCH] update-nixpkgs: fix manual actions on integration branch and cleanup We want that users can push to the integration branch and then run the action. This is the SOP for merge conflict handling. Currently this is broken as the intergration branch isn't fetched. Also only delete branches in cleanup that start with the current platform version. --- src/update_nixpkgs/cleanup.py | 6 +++--- src/update_nixpkgs/update.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/update_nixpkgs/cleanup.py b/src/update_nixpkgs/cleanup.py index 55649c2..9e1e516 100644 --- a/src/update_nixpkgs/cleanup.py +++ b/src/update_nixpkgs/cleanup.py @@ -76,7 +76,7 @@ def rebase_nixpkgs( return True -def cleanup_old_prs_and_branches(gh: Github, merged_integration_branch: str): +def cleanup_old_prs_and_branches(gh: Github, merged_integration_branch: str, platform_branch: str): info("Cleaning up old PRs and branches.") fc_nixos_repo = gh.get_repo(FC_NIXOS_REPO) nixpkgs_repo = gh.get_repo(NIXPKGS_REPO) @@ -86,7 +86,7 @@ def cleanup_old_prs_and_branches(gh: Github, merged_integration_branch: str): # branches will be closed automatically by GitHub, when the branch is deleted for repo in [fc_nixos_repo, nixpkgs_repo]: for branch in repo.get_branches(): - if not branch.name.startswith("nixpkgs-auto-update/"): + if not branch.name.startswith(f"nixpkgs-auto-update/{platform_branch}/"): continue branch_datestr = branch.name.split("/")[2] if ( @@ -124,4 +124,4 @@ def run( fc_nixos_pr.create_issue_comment( f"Rebased nixpkgs `{nixpkgs_target_branch}` branch successfully." ) - cleanup_old_prs_and_branches(gh, integration_branch) + cleanup_old_prs_and_branches(gh, integration_branch, fc_nixos_pr.base.ref) diff --git a/src/update_nixpkgs/update.py b/src/update_nixpkgs/update.py index 44405c0..2823c95 100644 --- a/src/update_nixpkgs/update.py +++ b/src/update_nixpkgs/update.py @@ -263,7 +263,7 @@ def run( "upstream": Remote(nixpkgs_upstream_url, [nixpkgs_target_branch]), "origin": Remote( nixpkgs_origin_url, - [nixpkgs_target_branch, last_day_integration_branch], + [nixpkgs_target_branch, integration_branch, last_day_integration_branch], ), } nixpkgs_repo = nixpkgs_repository(nixpkgs_dir, remotes)