From 7d6ef903be9638aad7ada1206470d932dc4bfc50 Mon Sep 17 00:00:00 2001 From: Galo Navarro Date: Sun, 10 Dec 2023 19:56:42 +0100 Subject: [PATCH] Fix can merge with additional roles (#126) author-can-merge was not considering all the roles that allow for committing into the base branch Fixes: #123 Signed-off-by: Galo Navarro --- pkg/condition_author_can_merge.go | 11 +++++------ pkg/labeler.go | 4 ---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pkg/condition_author_can_merge.go b/pkg/condition_author_can_merge.go index 0364285..181c6a3 100644 --- a/pkg/condition_author_can_merge.go +++ b/pkg/condition_author_can_merge.go @@ -19,18 +19,17 @@ func AuthorCanMergeCondition() Condition { return false, fmt.Errorf("author-can-merge doesn't have a valid value in config") } - ghRepo := target.ghPR.GetAuthorAssociation() - canMerge := ghRepo == "OWNER" + authorAssoc := target.ghPR.GetAuthorAssociation() + canMerge := authorAssoc == "MEMBER" || authorAssoc == "OWNER" || authorAssoc == "COLLABORATOR" if expected && canMerge { - fmt.Printf("User: %s can merge %t, condition matched\n", - target.Author, canMerge) + fmt.Printf("User: %s can merge, condition matched\n", target.Author) return true, nil } if !expected && !canMerge { - fmt.Printf("User: %s can not merge %t, condition matched\n", - target.Author, canMerge) + fmt.Printf("User: %s can not merge, condition matched\n", + target.Author) return true, nil } diff --git a/pkg/labeler.go b/pkg/labeler.go index 6436801..286d6f4 100644 --- a/pkg/labeler.go +++ b/pkg/labeler.go @@ -264,10 +264,6 @@ func (l *Labeler) findMatches(target *Target, config *LabelerConfigV1) (LabelUpd } else { // First condition evaluated for this label labelUpdates.set[label] = isMatched } - - if isMatched { - continue - } } if matcher.Negate {