Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow enabling "Delete source branch when merge request accepted" #126

Open
peat-psuwit opened this issue Apr 8, 2024 · 2 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@peat-psuwit
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I would prefer that the backported MR's branch be deleted automatically. This is possible via GitLab's "Delete source branch when merge request accepted" settings. This is exposed in the API as remove_source_branch.

Describe the solution you'd like
When configured as so, set attribute remove_source_branch as part of a request to POST /projects/:id/merge_requests. However, I'm not sure if there's the equivalent thing in GitHub, and as such I'm not sure how to model config. Maybe just documentation (that a config is GitLab only) is enough?

Describe alternatives you've considered

  • We can manually select "Delete source branch" just before pressing "Merge". However this is prone to forgetting.
  • We can parse the program's output to fish out the MR address from the log and then manually send PUT /projects/:id/merge_requests/:merge_request_iid. However, this can be prone to breakage.
@lampajr
Copy link
Member

lampajr commented Apr 8, 2024

Hi @peat-psuwit , this is for sure an interesting improvement!!

However, I'm not sure if there's the equivalent thing in GitHub

I don't know either, but I can find some time to investigate this on Github side.

Maybe just documentation (that a config is GitLab only) is enough?

I'd try to keep all clients feature-equivalents but if there are no ways on Github and for Gitlab it is as easy as you highlighted, yeah we can consider document that this would be a Gitlab-only feature

@lampajr lampajr added the enhancement New feature or request label Apr 8, 2024
@lampajr
Copy link
Member

lampajr commented Apr 8, 2024

We can manually select "Delete source branch" just before pressing "Merge". However this is prone to forgetting.
We can parse the program's output to fish out the MR address from the log and then manually send PUT /projects/:id/merge_requests/:merge_request_iid. However, this can be prone to breakage.

Another workaround, a bit more trickier (but I saw some repo using it) is to setup an additional workflow to cleanup backport branches if the corresponding PR/MR is merged, e.g., https://github.com/infinispan/infinispan/blob/main/.github/workflows/backport_reaper.yaml

@lampajr lampajr added the good first issue Good for newcomers label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants