From b6e9f863d399f0b4ddc69c74e654df16e304018d Mon Sep 17 00:00:00 2001 From: Oded Ben Ozer Date: Thu, 24 Oct 2024 11:48:38 +0200 Subject: [PATCH] Remove unneeded break/label thing. Just return true when a relevant app is found --- internal/pkg/githubapi/github.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/pkg/githubapi/github.go b/internal/pkg/githubapi/github.go index a5c1295b..338c5910 100644 --- a/internal/pkg/githubapi/github.go +++ b/internal/pkg/githubapi/github.go @@ -110,9 +110,6 @@ func (ghPrClientDetails *GhPrClientDetails) getBlameURLPrefix() string { // - The component is allowed to be synced from a branch(based on Telefonsitka configuration) // - The relevant app is not new, temporary app that was created just to generate the diff func shouldSyncBranchCheckBoxBeDisplayed(componentPathList []string, allowSyncfromBranchPathRegex string, diffOfChangedComponents []argocd.DiffResult) bool { - var displaySyncBranchCheckBox bool - -outOfLoop: for _, componentPath := range componentPathList { // First we check if the component is allowed to be synced from a branch if !isSyncFromBranchAllowedForThisPath(allowSyncfromBranchPathRegex, componentPath) { @@ -122,13 +119,11 @@ outOfLoop: // We don't support syncing new apps from branches for _, diffOfChangedComponent := range diffOfChangedComponents { if diffOfChangedComponent.ComponentPath == componentPath && !diffOfChangedComponent.AppWasTemporarilyCreated { - displaySyncBranchCheckBox = true - break outOfLoop + return true } } } - - return displaySyncBranchCheckBox + return false } func HandlePREvent(eventPayload *github.PullRequestEvent, ghPrClientDetails GhPrClientDetails, mainGithubClientPair GhClientPair, approverGithubClientPair GhClientPair, ctx context.Context) {