mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 09:58:29 +02:00
make PR workflow helpers more robust (#300)
improve handling of remote deleted branches split git.TeaDeleteBranch only delete remote branch if we have permission add missing err check Co-authored-by: Norwin Roosen <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/300 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-Authored-By: Norwin <noerw@noreply.gitea.io> Co-Committed-By: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -27,6 +27,10 @@ func PullCheckout(login *config.Login, repoOwner, repoName string, index int64,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
remoteDeleted := pr.Head.Ref == fmt.Sprintf("refs/pull/%d/head", pr.Index)
|
||||
if remoteDeleted {
|
||||
return fmt.Errorf("Can't checkout: remote head branch was already deleted")
|
||||
}
|
||||
|
||||
remoteURL := pr.Head.Repository.CloneURL
|
||||
if len(login.SSHKey) != 0 {
|
||||
|
Reference in New Issue
Block a user