create-pull-request icon indicating copy to clipboard operation
create-pull-request copied to clipboard

[Feature Request] Do not overwrite existing pull request if the branch has been touched by others

Open giordano opened this issue 4 months ago • 2 comments

We have a workflow where we open a pull request to update a file, on schedule. We'd like to keep updating the PR, if already opened and not merged, only if the content of the branch hasn't been touched by other users. Would that be an acceptable feature request for this workflow? 🙂 CC: @wsmoses

giordano avatar Sep 16 '25 19:09 giordano

Basically around https://github.com/peter-evans/create-pull-request/blob/915d841dae6a4f191bb78faf61a257411d7be4d2/src/create-or-update-branch.ts#L297-L310 we'd like more logic to handle the case "if there's only one commit ahead of the target branch, then push and we're all happy, otherwise exit silently because we think someone else pushed fixes that we shouldn't really overwrite"

giordano avatar Sep 16 '25 20:09 giordano

Hi @giordano

I have considered this in the past and I don't think I came up with a good solution. I would be open to adding this feature, but I would need to give this a lot more thought. I'll try and find some time.

peter-evans avatar Dec 02 '25 20:12 peter-evans