[API] - Capture GH Branch Rename And Adjust DB
Our DB doesn't keep in sync with branches that are adjusted in GH. We want to do so, but GH doesn't have a "branch rename" webhook event. There's investigation done about this here https://github.com/codecov/feedback/issues/393. The proposed solution is in this comment,https://github.com/codecov/feedback/issues/393#issuecomment-2378217110, where we detect 2 webhook events that contain a branch name before/after said events. This ticket is to contemplate adding this functionality to this endpoint. Labelling it as Epic as it could take some work but could also be a task.
Hi @adrian-codecov, our team is also facing described issue (when default branch was renamed in repo, then codecov UI does not show renamed default branch analytics and stops to update analytics for old branch as well) and I'm checking in to see if there has been any progress on this epic or if there are any current plans to address it.
Also, while we wait for a fix to be developed, could you please advise if there is a manual fix path we could execute for the affected branch? From what I see in https://github.com/codecov/feedback/issues/393#issuecomment-2378217110 it can be smth like:
- Find all the commits for affected repo in codecov DB that have branch =
old_branch. - Rename all of those commits from
old_branchtonew_branch. Do a follow-up check if the renamed branch is repo.branch (the main branch) and change that. - Query the branch table for
old_branch+ replace it with new_branch.