@@ -85,6 +85,27 @@ func isActorSkipped(actor *UserCommitSummary, config string) bool {
8585 return propertyMatches (usernamePattern , username ) && propertyMatches (emailPattern , email )
8686}
8787
88+ func actorToString (actor * UserCommitSummary ) string {
89+ const nullStr = "(null)"
90+ if actor == nil {
91+ return nullStr
92+ }
93+ id , login , username , email := nullStr , nullStr , nullStr , nullStr
94+ if actor .CommitAuthor != nil && actor .CommitAuthor .ID != nil {
95+ id = fmt .Sprintf ("%v" , * actor .CommitAuthor .ID )
96+ }
97+ if actor .CommitAuthor != nil && actor .CommitAuthor .Login != nil {
98+ login = * actor .CommitAuthor .Login
99+ }
100+ if actor .CommitAuthor != nil && actor .CommitAuthor .Name != nil {
101+ username = * actor .CommitAuthor .Name
102+ }
103+ if actor .CommitAuthor != nil && actor .CommitAuthor .Email != nil {
104+ email = * actor .CommitAuthor .Email
105+ }
106+ return fmt .Sprintf ("id='%v',login='%v',username='%v',email='%v'" , id , login , username , email )
107+ }
108+
88109// SkipWhitelistedBots- check if the actors are whitelisted based on the skip_cla configuration.
89110// Returns two lists:
90111// - actors still missing cla: actors who still need to sign the CLA after checking skip_cla
@@ -127,7 +148,6 @@ func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization,
127148 }
128149
129150 var config string
130-
131151 // 1. Exact match
132152 if val , ok := skipCLA [repo ]; ok {
133153 config = val
@@ -168,27 +188,21 @@ func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization,
168188 log .WithFields (f ).Debug ("No skip_cla config found for repo, skipping whitelisted bots check" )
169189 return actorsMissingCLA , []* UserCommitSummary {}
170190 }
171- const nullStr = "(null)"
191+
192+ // Log full configuration
193+ actorDebugData := make ([]string , 0 , len (actorsMissingCLA ))
194+ for _ , a := range actorsMissingCLA {
195+ actorDebugData = append (actorDebugData , actorToString (a ))
196+ }
197+ log .WithFields (f ).Debugf ("final skip_cla config for repo %s is %s; actorsMissingCLA: [%s]" , orgRepo , config , strings .Join (actorDebugData , ", " ))
172198
173199 for _ , actor := range actorsMissingCLA {
200+ if actor == nil {
201+ continue
202+ }
203+ actorData := actorToString (actor )
204+ log .WithFields (f ).Debugf ("Checking actor: %s for skip_cla config: %s" , actorData , config )
174205 if isActorSkipped (actor , config ) {
175- if actor == nil {
176- continue
177- }
178- id , login , username , email := nullStr , nullStr , nullStr , nullStr
179- if actor .CommitAuthor != nil && actor .CommitAuthor .ID != nil {
180- id = fmt .Sprintf ("%v" , * actor .CommitAuthor .ID )
181- }
182- if actor .CommitAuthor != nil && actor .CommitAuthor .Login != nil {
183- login = * actor .CommitAuthor .Login
184- }
185- if actor .CommitAuthor != nil && actor .CommitAuthor .Name != nil {
186- username = * actor .CommitAuthor .Name
187- }
188- if actor .CommitAuthor != nil && actor .CommitAuthor .Email != nil {
189- email = * actor .CommitAuthor .Email
190- }
191- actorData := fmt .Sprintf ("id='%v',login='%v',username='%v',email='%v'" , id , login , username , email )
192206 msg := fmt .Sprintf (
193207 "Skipping CLA check for repo='%s', actor: %s due to skip_cla config: '%s'" ,
194208 orgRepo , actorData , config ,
@@ -202,8 +216,6 @@ func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization,
202216 ev .LogEvent (& events.LogEventArgs {
203217 EventType : events .BypassCLA ,
204218 EventData : & eventData ,
205- UserID : id ,
206- UserName : login ,
207219 ProjectID : projectID ,
208220 })
209221 log .WithFields (f ).Debugf ("event logged" )
0 commit comments