Просмотр исходного кода

fix for head branch not exists at all

Mohammed Nafees 3 лет назад
Родитель
Сommit
17f60cbc49
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      internal/integrations/ci/actions/preview.go

+ 2 - 2
internal/integrations/ci/actions/preview.go

@@ -397,7 +397,7 @@ func createNewBranch(
 	client *github.Client,
 	gitRepoOwner, gitRepoName, baseBranch, headBranch string,
 ) error {
-	_, _, err := client.Repositories.GetBranch(
+	_, resp, err := client.Repositories.GetBranch(
 		context.Background(), gitRepoOwner, gitRepoName, headBranch, true,
 	)
 
@@ -412,7 +412,7 @@ func createNewBranch(
 		if err != nil {
 			return err
 		}
-	} else {
+	} else if resp.StatusCode != http.StatusNotFound {
 		return err
 	}