Jelajahi Sumber

fix for head branch not exists at all

Mohammed Nafees 3 tahun lalu
induk
melakukan
17f60cbc49
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  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
 	}