From 90b8d66946c249b2634a79c12d0212153ca4c9d0 Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Tue, 28 Feb 2023 02:08:17 +0530 Subject: [PATCH] fix: add pagination for github repositories endpoint (#345) --- apiserver/plane/api/views/integration/github.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/api/views/integration/github.py b/apiserver/plane/api/views/integration/github.py index df8f1d0c2..5660e9d90 100644 --- a/apiserver/plane/api/views/integration/github.py +++ b/apiserver/plane/api/views/integration/github.py @@ -25,11 +25,15 @@ from plane.utils.integrations.github import get_github_repos class GithubRepositoriesEndpoint(BaseAPIView): def get(self, request, slug, workspace_integration_id): try: + page = request.GET.get("page", 1) workspace_integration = WorkspaceIntegration.objects.get( workspace__slug=slug, pk=workspace_integration_id ) access_tokens_url = workspace_integration.metadata["access_tokens_url"] - repositories_url = workspace_integration.metadata["repositories_url"] + repositories_url = ( + workspace_integration.metadata["repositories_url"] + + f"?per_page=100&page={page}" + ) repositories = get_github_repos(access_tokens_url, repositories_url) return Response(repositories, status=status.HTTP_200_OK) except WorkspaceIntegration.DoesNotExist: