Skip to content

Commit

Permalink
Add some validation to avoid auto-merging PRs in cases telefonistka is
Browse files Browse the repository at this point in the history
unsure of the component that where changed
  • Loading branch information
Oded-B committed May 21, 2024
1 parent f18bd46 commit 2a5adc2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/pkg/githubapi/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ func HandlePREvent(eventPayload *github.PullRequestEvent, ghPrClientDetails GhPr
} else {
ghPrClientDetails.PrLogger.Debugf("PR %v labeled\n%+v", *eventPayload.PullRequest.Number, prLables)
}
if DoesPrHasLabel(*eventPayload, "promotion") && config.AutoMergeNoDiffPRs {
// If the PR is a promotion PR and the diff is empty, we can auto-merge it
// "len(componentPathList) > 0" validates we are not auto-merging a PR that we failed to understand which apps it affects
if DoesPrHasLabel(*eventPayload, "promotion") && config.AutoMergeNoDiffPRs && len(componentPathList) > 0 {
ghPrClientDetails.PrLogger.Infof("Auto-merging (no diff) PR %d", *eventPayload.PullRequest.Number)
err := MergePr(ghPrClientDetails, eventPayload.PullRequest.Number)
if err != nil {
Expand Down

0 comments on commit 2a5adc2

Please sign in to comment.