@@ -182,7 +182,12 @@ def get_repository_id(self, repo_name, installation_id=None):
182182 cla .log .error ("Unknown error while getting GitHub repository ID for repository %s: %s" , repo_name , str (err ))
183183
184184 def received_activity (self , data ):
185- cla .log .debug ("github_models.received_activity - Received GitHub activity: %s" , data )
185+ cla .log .debug (
186+ "github_models.received_activity - received GitHub activity action=%s pull_request=%s merge_group=%s" ,
187+ data .get ("action" ),
188+ "pull_request" in data ,
189+ "merge_group" in data ,
190+ )
186191 if "pull_request" not in data and "merge_group" not in data :
187192 cla .log .debug ("github_models.received_activity - Activity not related to pull request - ignoring" )
188193 return {"message" : "Not a pull request nor a merge group - no action performed" }
@@ -206,7 +211,7 @@ def received_activity(self, data):
206211
207212 def user_from_session (self , request , get_redirect_url ):
208213 fn = "github_models.user_from_session"
209- cla .log .debug (f"{ fn } - loading session from request: { request } ... " )
214+ cla .log .debug (f"{ fn } - loading session from request" )
210215 session = self ._get_request_session (request )
211216 cla .log .debug (f"{ fn } - session loaded (keys={ list (session .keys ())} )" )
212217
@@ -217,7 +222,7 @@ def user_from_session(self, request, get_redirect_url):
217222 if user is None :
218223 cla .log .debug (f"{ fn } - cannot find user, returning HTTP 404 status" )
219224 else :
220- cla .log .debug (f"{ fn } - loaded user { user . to_dict () } returning HTTP 200 status" )
225+ cla .log .debug (f"{ fn } - loaded user returning HTTP 200 status" )
221226 return user
222227
223228 authorization_url , csrf_token = self .get_authorization_url_and_state (None , None , None , ["user:email" ], state = 'user-from-session' )
@@ -245,7 +250,7 @@ def sign_request(self, installation_id, github_repository_id, change_request_id,
245250 )
246251
247252 # Not sure if we need a different token for each installation ID...
248- cla .log .debug (f"{ fn } - Loading session from request: { request } ... " )
253+ cla .log .debug (f"{ fn } - Loading session from request" )
249254 session = self ._get_request_session (request )
250255 cla .log .debug (f"{ fn } - Adding github details to session: { list (session .keys ())} which is type: { type (session )} ..." )
251256 session ["github_installation_id" ] = installation_id
@@ -254,9 +259,9 @@ def sign_request(self, installation_id, github_repository_id, change_request_id,
254259
255260 cla .log .debug (f"{ fn } - Determining return URL from the inbound request..." )
256261 origin_url = self .get_return_url (github_repository_id , change_request_id , installation_id )
257- cla .log .debug (f"{ fn } - Return URL from the inbound request is { origin_url } " )
262+ cla .log .debug (f"{ fn } - return URL resolved from inbound request" )
258263 session ["github_origin_url" ] = origin_url
259- cla .log .debug (f'{ fn } - Stored origin url in session as session["github_origin_url"] = { origin_url } ' )
264+ cla .log .debug (f'{ fn } - stored origin url in session' )
260265
261266 if "github_oauth2_token" in session :
262267 cla .log .debug (f"{ fn } - Using existing session GitHub OAuth2 token" )
@@ -278,7 +283,7 @@ def _get_request_session(self, request) -> dict: # pylint: disable=no-self-use
278283 fn = "cla.models.github_models._get_request_session"
279284 session = request .context .get ("session" )
280285 if session is None :
281- cla .log .warning (f"{ fn } - Session is empty for request: { request } " )
286+ cla .log .warning (f"{ fn } - session is empty for request" )
282287 session = {}
283288 request .context ["session" ] = session
284289
@@ -355,7 +360,7 @@ def oauth2_redirect(self, state, code, request): # pylint: disable=too-many-arg
355360 further requests and initiate the signing workflow.
356361 """
357362 fn = "github_models.oauth2_redirect"
358- cla .log .debug (f"{ fn } - handling GitHub OAuth2 redirect with request: { dir ( request ) } " )
363+ cla .log .debug (f"{ fn } - handling GitHub OAuth2 redirect callback " )
359364 session = self ._get_request_session (request ) # request.context['session']
360365
361366 if "github_oauth2_state" in session :
@@ -388,7 +393,7 @@ def oauth2_redirect(self, state, code, request): # pylint: disable=too-many-arg
388393 cla .log .debug (f"handling user-from-session callback" )
389394 token_url = cla .conf ["GITHUB_OAUTH_TOKEN_URL" ]
390395 client_id = os .environ ["GH_OAUTH_CLIENT_ID" ]
391- cla .log .debug (f"{ fn } - using client ID { client_id [ 0 : 5 ] } ... " )
396+ cla .log .debug (f"{ fn } - using configured GitHub OAuth client " )
392397 client_secret = os .environ ["GH_OAUTH_SECRET" ]
393398 try :
394399 token = self ._fetch_token (client_id , state , token_url , client_secret , code )
@@ -401,7 +406,7 @@ def oauth2_redirect(self, state, code, request): # pylint: disable=too-many-arg
401406 if user is None :
402407 cla .log .debug (f"{ fn } - cannot find user, returning HTTP 404 status" )
403408 else :
404- cla .log .debug (f"{ fn } - loaded user { user . to_dict () } returning HTTP 200 status" )
409+ cla .log .debug (f"{ fn } - loaded user returning HTTP 200 status" )
405410 return user .to_dict ()
406411
407412 # Get session information for this request.
@@ -414,11 +419,11 @@ def oauth2_redirect(self, state, code, request): # pylint: disable=too-many-arg
414419 token_url = cla .conf ["GITHUB_OAUTH_TOKEN_URL" ]
415420 client_id = os .environ ["GH_OAUTH_CLIENT_ID" ]
416421 client_secret = os .environ ["GH_OAUTH_SECRET" ]
417- cla .log .debug (f"{ fn } - fetching oauth2 token with client ID: { client_id [ 0 : 5 ] } ..., token_url: { token_url } " )
422+ cla .log .debug (f"{ fn } - fetching oauth2 token from configured GitHub endpoint " )
418423 token = self ._fetch_token (client_id , state , token_url , client_secret , code )
419424 cla .log .debug (f"{ fn } - oauth2 token received - storing token in session" )
420425 session ["github_oauth2_token" ] = token
421- cla .log .debug (f"{ fn } - redirecting the user back to the console: { origin_url } " )
426+ cla .log .debug (f"{ fn } - redirecting the user back to the contributor console " )
422427 return self .redirect_to_console (installation_id , github_repository_id , change_request_id , origin_url , request )
423428
424429 def redirect_to_console (self , installation_id , repository_id , pull_request_id , origin_url , request ):
0 commit comments