@@ -5,12 +5,13 @@ package github
55
66import (
77 "fmt"
8+ "regexp"
9+ "strings"
10+
811 "github.com/linuxfoundation/easycla/cla-backend-go/events"
912 "github.com/linuxfoundation/easycla/cla-backend-go/gen/v1/models"
1013 log "github.com/linuxfoundation/easycla/cla-backend-go/logging"
1114 "github.com/sirupsen/logrus"
12- "regexp"
13- "strings"
1415)
1516
1617// propertyMatches returns true if value matches the pattern.
@@ -74,10 +75,10 @@ func isActorSkipped(actor *UserCommitSummary, config string) bool {
7475 username string
7576 email string
7677 )
77- if actor .CommitAuthor != nil && actor .CommitAuthor .Login != nil {
78+ if actor != nil && actor .CommitAuthor != nil && actor .CommitAuthor .Login != nil {
7879 username = * actor .CommitAuthor .Login
7980 }
80- if actor .CommitAuthor != nil && actor .CommitAuthor .Email != nil {
81+ if actor != nil && actor .CommitAuthor != nil && actor .CommitAuthor .Email != nil {
8182 email = * actor .CommitAuthor .Email
8283 }
8384
@@ -167,10 +168,14 @@ func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization,
167168 log .WithFields (f ).Debug ("No skip_cla config found for repo, skipping whitelisted bots check" )
168169 return actorsMissingCLA , []* UserCommitSummary {}
169170 }
171+ const nullStr = "(null)"
170172
171173 for _ , actor := range actorsMissingCLA {
172174 if isActorSkipped (actor , config ) {
173- id , login , username , email := "(null)" , "(null)" , "(null)" , "(null)"
175+ if actor == nil {
176+ continue
177+ }
178+ id , login , username , email := nullStr , nullStr , nullStr , nullStr
174179 if actor .CommitAuthor != nil && actor .CommitAuthor .ID != nil {
175180 id = fmt .Sprintf ("%v" , * actor .CommitAuthor .ID )
176181 }
0 commit comments