Firstly, thank you all contributors for this library. This is an incredible tool for polyrepo support :)
Is your feature request related to a problem? Please describe.
The "updateRepo" function provides a way to create a new branch in a repo and update it, but does not let you use an existing branch.
Describe the solution you'd like
I would like to be able to use the same tool to re-create a branch with the same name, with the use of a flag and the "deleteBranch" function for the existing branch, while the default behaviour is preserved. It could look something like this:
await updateRepo({
updateCallback: updateCallback,
branch: branch,
deleteBranchIfExists: true, <---
message: 'chore: update README',
comment: 'chore: update README',
reviewers: [],
});
Describe alternatives you've considered
Using "updateFileInBranch", but it is limited to a single file only.
Additional context
Notably, trying to update an existing branch with the HEAD of the last commit of the default branch will not always work out due to potential conflicts. Therefore my suggestion is to delete the specified branch and recreate it before proceeding, rather than adding commits on top.
I am happy to implement this and raise a PR should this be considered an acceptable use case.
TIA!