NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.6k stars 13.08k forks source link

Backport action: Automatically delete old branches #128105

Open primeos opened 3 years ago

primeos commented 3 years ago

It would be nice if the GitHub action for backports would automatically delete branches in NixOS/nixpkgs after merging or closing PRs (or if we had another GH action that deletes old backport-* branches without an open PR). It might also be desirable to create the branches in a different repository (that way the backport action might not even need write access to Nixpkgs).

Initially I didn't know that I had to delete these branches manually (https://github.com/NixOS/nixpkgs/pull/127458#issuecomment-865003289) but even if one knows this it requires an additional manual step that might be easy to miss once in a while.

Ideally https://github.com/zeebe-io/backport-action would handle this and GitHub would offer a PR setting to delete the source branch after merging (like GitLab does: https://docs.gitlab.com/ee/user/project/merge_requests/getting_started.html#deleting-the-source-branch). Since that's unlikely to happen anytime soon we could write a GitHub action that runs periodically and deletes all branches matching backport-[0-9]+-to-release-[0-9]{2}\.[0-9]{2} that are associated with a merged PR (or something like that).

mohe2015 commented 3 years ago

In the project settings there is "Automatically delete head branches" which may also work. Description is "After pull requests are merged, you can have head branches deleted automatically." and it notes "Deleted branches will still be able to be restored."

sternenseemann commented 3 years ago

In the project settings there is "Automatically delete head branches" which may also work. Description is "After pull requests are merged, you can have head branches deleted automatically." and it notes "Deleted branches will still be able to be restored."

This won't work because there are branches which would briefly (multiple hours) be head branches, but have PRs targeted against them, like haskell-updates. Deleting such a branch results in all PRs targeted against it being deleted.

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

Artturin commented 2 years ago

i've been removing the merged branches manually using https://github.com/NixOS/nixpkgs/branches/all?query=backport