@@ -73,16 +73,41 @@ def get_copilot_team_date(gh: github_api_toolkit.github_interface, page: int) ->
7373 usage_data = gh .get (f"/orgs/{ org } /team/{ team ['name' ]} /copilot/metrics" )
7474
7575 if not isinstance (usage_data , Response ):
76- logger .error ("Unexpected response type: %s" , type (usage_data ))
76+
77+ # If the response is not a Response object, no copilot data is available for this team
78+ # We can then skip this team
79+
80+ # We don't log this as an error, as it is expected and it'd be too noisy within logs
81+
7782 continue
78- copilot_teams .append (
79- {
80- "name" : team .get ("name" , "" ),
81- "slug" : team .get ("slug" , "" ),
82- "description" : team .get ("description" , "" ),
83- "url" : team .get ("html_url" , "" ),
84- }
85- )
83+
84+ # If the response has data, append the team to the list
85+ # If there is no data, .json() will return an empty list
86+ if usage_data .json ():
87+
88+ team_name = team .get ("name" , "" )
89+ team_slug = team .get ("slug" , "" )
90+ team_description = team .get ("description" , "" )
91+ team_html_url = team .get ("html_url" , "" )
92+
93+ logger .info (
94+ "Team %s has Copilot data" ,
95+ extra = {
96+ "team_name" : team_name ,
97+ "team_slug" : team_slug ,
98+ "team_description" : team_description ,
99+ "team_html_url" : team_html_url ,
100+ },
101+ )
102+
103+ copilot_teams .append (
104+ {
105+ "name" : team_name ,
106+ "slug" : team_slug ,
107+ "description" : team_description ,
108+ "url" : team_html_url ,
109+ }
110+ )
86111
87112 return copilot_teams
88113
0 commit comments