Parcourir la source

hotfix for env error

Mohammed Nafees il y a 3 ans
Parent
commit
a6c7439050
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      api/server/handlers/webhook/github_incoming.go

+ 5 - 1
api/server/handlers/webhook/github_incoming.go

@@ -76,7 +76,11 @@ func (c *GithubIncomingWebhookHandler) processPullRequestEvent(event *github.Pul
 
 	env, err := c.Repo().Environment().ReadEnvironmentByWebhookIDOwnerRepoName(webhookID, owner, repo)
 
-	if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
+	if err != nil {
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			return nil
+		}
+
 		return fmt.Errorf("[webhookID: %s, owner: %s, repo: %s] error reading environment: %w", webhookID, owner, repo, err)
 	}