Skip to content

Commit 6b5e26c

Browse files
Fix logic issue
Signed-off-by: Lukasz Gryglicki <[email protected]>
1 parent b09977d commit 6b5e26c

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

cla-backend-go/signatures/service.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,13 @@ func (s service) updateChangeRequest(ctx context.Context, ghOrg *models.GithubOr
11141114
}
11151115

11161116
log.WithFields(f).Debugf("commit authors status => signed: %+v and missing: %+v", signed, unsigned)
1117-
unsigned, signed = github.SkipWhitelistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
1118-
log.WithFields(f).Debugf("commit authors status after whitelisting bots => signed: %+v and missing: %+v", signed, unsigned)
1117+
var whitelisted []*github.UserCommitSummary
1118+
unsigned, whitelisted = github.SkipWhitelistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
1119+
if len(whitelisted) > 0 {
1120+
log.WithFields(f).Debugf("adding %d whitelisted actors to signed list", len(whitelisted))
1121+
signed = append(signed, whitelisted...)
1122+
}
1123+
log.WithFields(f).Debugf("commit authors status after whitelisting bots => signed: %+v, missing: %+v, whitelisted: %+v", signed, unsigned, whitelisted)
11191124

11201125
// update pull request
11211126
updateErr := github.UpdatePullRequest(ctx, ghOrg.OrganizationInstallationID, int(pullRequestID), gitHubOrgName, gitHubRepoName, githubRepository.ID, *latestSHA, signed, unsigned, s.claBaseAPIURL, s.claLandingPage, s.claLogoURL)

cla-backend-go/v2/sign/helpers.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,13 @@ func (s service) updateChangeRequest(ctx context.Context, installationID, reposi
148148

149149
log.WithFields(f).Debugf("commit authors status => signed: %+v and missing: %+v", signed, unsigned)
150150
if ghOrg != nil {
151-
unsigned, signed = github.SkipWhitelistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
152-
log.WithFields(f).Debugf("commit authors status after whitelisting bots => signed: %+v and missing: %+v", signed, unsigned)
151+
var whitelisted []*github.UserCommitSummary
152+
unsigned, whitelisted = github.SkipWhitelistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
153+
if len(whitelisted) > 0 {
154+
log.WithFields(f).Debugf("adding %d whitelisted actors to signed list", len(whitelisted))
155+
signed = append(signed, whitelisted...)
156+
}
157+
log.WithFields(f).Debugf("commit authors status after whitelisting bots => signed: %+v, missing: %+v, whitelisted: %+v", signed, unsigned, whitelisted)
153158
}
154159

155160
// update pull request

cla-backend/cla/models/github_models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,10 @@ def update_merge_group(self, installation_id, github_repository_id, merge_group_
741741
# Skip whitelisted bots per org/repo GitHub login/email regexps
742742
# repo can be defined as '*' (all repos) or re:<regexp> (regexp to match repo name) or 'repo-name' for exact match
743743
# the same for value which is GitHub login match then ; separator and then email match (same matching via * or re:<regexp> or exact-match)
744-
missing, signed = self.skip_whitelisted_bots(github_org, repository.get_repository_name(), missing)
744+
missing, whitelisted = self.skip_whitelisted_bots(github_org, repository.get_repository_name(), missing)
745+
if whitelisted is not None and len(whitelisted) > 0:
746+
cla.log.debug(f"{fn} - adding {len(whitelisted)} whitelisted actors to signed list")
747+
signed.extend(whitelisted)
745748

746749
# update Merge group status
747750
self.update_merge_group_status(
@@ -906,7 +909,10 @@ def update_change_request(self, installation_id, github_repository_id, change_re
906909
# Skip whitelisted bots per org/repo GitHub login/email regexps
907910
# repo can be defined as '*' (all repos) or re:<regexp> (regexp to match repo name) or 'repo-name' for exact match
908911
# the same for value which is GitHub login match then ; separator and then email match (same matching via * or re:<regexp> or exact-match)
909-
missing, signed = self.skip_whitelisted_bots(github_org, repository.get_repository_name(), missing)
912+
missing, whitelisted = self.skip_whitelisted_bots(github_org, repository.get_repository_name(), missing)
913+
if whitelisted is not None and len(whitelisted) > 0:
914+
cla.log.debug(f"{fn} - adding {len(whitelisted)} whitelisted actors to signed list")
915+
signed.extend(whitelisted)
910916
# At this point, the signed and missing lists are now filled and updated with the commit user info
911917

912918
cla.log.debug(

0 commit comments

Comments
 (0)