(
organisation_id: int,
params: RepoQueryParams,
)
| 269 | |
| 270 | |
| 271 | def fetch_github_repo_contributors( |
| 272 | organisation_id: int, |
| 273 | params: RepoQueryParams, |
| 274 | ) -> dict[str, Any]: |
| 275 | installation_id = GithubConfiguration.objects.get( |
| 276 | organisation_id=organisation_id, deleted_at__isnull=True |
| 277 | ).installation_id |
| 278 | |
| 279 | url = ( |
| 280 | f"{GITHUB_API_URL}repos/{params.repo_owner}/{params.repo_name}/contributors?" |
| 281 | + f"&per_page={params.page_size}&page={params.page}" |
| 282 | ) |
| 283 | |
| 284 | headers = build_request_headers(installation_id) |
| 285 | response = requests.get(url, headers=headers, timeout=GITHUB_API_CALLS_TIMEOUT) |
| 286 | response.raise_for_status() |
| 287 | json_response = response.json() |
| 288 | |
| 289 | results = [ |
| 290 | { |
| 291 | "login": i["login"], |
| 292 | "avatar_url": i["avatar_url"], |
| 293 | "contributions": i["contributions"], |
| 294 | } |
| 295 | for i in json_response |
| 296 | ] |
| 297 | |
| 298 | return build_paginated_response(results, response) |
| 299 | |
| 300 | |
| 301 | def create_flagsmith_flag_label( # type: ignore[return] |
no test coverage detected
searching dependent graphs…