thoth-station / prescriptions-refresh-job

A periodic job to refresh Thoth's prescriptions
GNU General Public License v3.0
0 stars 7 forks source link

Automatically purge branches from the prescriptions repository #172

Closed codificat closed 2 years ago

codificat commented 2 years ago

Is your feature request related to a problem? Please describe.

The PRs created by the prescriptions refresh job use branches in the prescriptions repository.

Once the PRs have been closed, (some of?) these branches remain there.

Right now the repository has almost 10k branches:

$ git branch -a | grep remotes/upstream/ | wc -l
9680

Describe the solution you'd like

It would be nice to have a mechanism that automates the clean-up of these branches.

codificat commented 2 years ago

/kind feature /priority important-longterm /sig stack-guidance

mayaCostantini commented 2 years ago

Could we configure this directly in the repo? https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches

codificat commented 2 years ago

Could we configure this directly in the repo? https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches

That would be nice! I personally would much prefer that over the GitHub Action approach. However, we avoid doing manual configuration of the org repos...

I took a quick look at peribolos and I believe this setting can't be managed from there.

One alternative that could help, though, could be the branchcleaner prow plugin.

mayaCostantini commented 2 years ago

Thanks for the suggestion :+1: I have configured the repo to automatically delete merged branches but I am not sure this worked with the last prescriptions-refresh-job. If you think the branchcleaner plugin could be easily configured, feel free to go ahead with this solution

sesheta commented 2 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

codificat commented 2 years ago

/remove-lifecycle stale

I have configured the repo to automatically delete merged branches

Thanks!

but I am not sure this worked with the last prescriptions-refresh-job.

It seems to work. Just to give an example, the brach pres-bluepy-pypi_release.yaml from #30239 (part of this past week's refresh) is not in the repo anymore.

However, we probably want to go one step further and find a way to clean stale branches as well - containing non-merged changes but that are not active anymore. One example is the pres-bluepyopt-pypi_project_maintainers.yaml branch created 2 weeks ago, for which there is no corresponding PR and whose commit is not in the current master.