Skip to content

Commit

Permalink
update-nixpkgs: fix manual actions on integration branch and cleanup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
leona-ya committed Dec 9, 2024
1 parent 102647b commit 0e3a236
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/update_nixpkgs/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 (
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/update_nixpkgs/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0e3a236

Please sign in to comment.