Skip to content

Commit 692fc06

Browse files
authored
add the ability to ignore certain events (#1829)
1 parent 16a1d63 commit 692fc06

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backend/controllers/github.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ func handlePullRequestEvent(gh utils.GithubClientProvider, payload *github.PullR
357357
}
358358
}
359359

360+
if !slices.Contains([]string{"closed", "opened", "reopened", "synchronize", "converted_to_draft"}, action) {
361+
log.Printf("The action %v is not one that we should act on, ignoring webhook event", action)
362+
return nil
363+
}
364+
360365
commentReporterManager := utils.InitCommentReporterManager(ghService, prNumber)
361366
if _, exists := os.LookupEnv("DIGGER_REPORT_BEFORE_LOADING_CONFIG"); exists {
362367
_, err := commentReporterManager.UpdateComment(":construction_worker: Digger starting....")
@@ -605,7 +610,6 @@ func getDiggerConfigForPR(gh utils.GithubClientProvider, orgId uint, prLabels []
605610
return "", nil, nil, nil, nil, nil, fmt.Errorf("error loading digger.yml: %v", err)
606611
}
607612

608-
log.Printf("Digger config loadded successfully\n")
609613
return diggerYmlStr, ghService, config, dependencyGraph, &prBranch, &prCommitSha, nil
610614
}
611615

0 commit comments

Comments
 (0)