pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 3 forks source link

It's possible that pre-commit-ci pushes to a branch which was just deleted #40

Closed asottile closed 3 years ago

asottile commented 3 years ago

That failure mode looks something like this:

Jan 10 13:58:40 ip-172-31-90-4 python3[379]: ====> pushing...
Jan 10 13:58:41 ip-172-31-90-4 python3[163652]: [move-to-declarative-setup-cfg-#10 14ad2bc] [pre-commit.ci] auto fixes from pre-commit.com hooks
Jan 10 13:58:41 ip-172-31-90-4 python3[163652]:  Date: Sun Jan 10 13:58:40 2021 +0000
Jan 10 13:58:41 ip-172-31-90-4 python3[163652]:  1 file changed, 1 deletion(-)
Jan 10 13:58:41 ip-172-31-90-4 python3[379]: =======> cherry picked!
Jan 10 13:58:43 ip-172-31-90-4 python3[163653]: To https://github.com/symonk/zonic
Jan 10 13:58:43 ip-172-31-90-4 python3[163653]:  ! [remote rejected] HEAD -> move-to-declarative-setup-cfg-#10 (cannot lock ref 'refs/heads/move-to-declarative-setup-cfg-#10': unable to resolve reference 'refs/heads/move-to-declarative-setup-cfg-#10')
Jan 10 13:58:43 ip-172-31-90-4 python3[163653]: error: failed to push some refs to 'https://x-access-token:<<<SNIP>>>@github.com/symonk/zonic'
Jan 10 13:58:43 ip-172-31-90-4 python3[379]: =======> push failed :(
Jan 10 13:58:47 ip-172-31-90-4 python3[163662]: remote:
Jan 10 13:58:47 ip-172-31-90-4 python3[163662]: remote: Create a pull request for 'move-to-declarative-setup-cfg-#10' on GitHub by visiting:
Jan 10 13:58:47 ip-172-31-90-4 python3[163662]: remote:      https://github.com/symonk/zonic/pull/new/move-to-declarative-setup-cfg-%2310
Jan 10 13:58:47 ip-172-31-90-4 python3[163662]: remote:
Jan 10 13:58:47 ip-172-31-90-4 python3[379]: =======> pushed!

I believe I can use --force-with-lease=<refname>:<originalref> to require the branch to already exist while pushing ?

This scenario happens when:

CC @symonk since you may want to clean up that branch

asottile commented 3 years ago

this has been fixed -- I used this strategy