From 17e64674f5aaca2923d5b0022f4e599308c23556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 2 Nov 2022 00:48:15 +0100 Subject: [PATCH] repo list: fix when belonging to org with IP Allow list enabled Using `ownerAffiliations` instead of `affiliations` seems more semantically correct to list all repos belonging to a user or an organization, but the latter thas an added benefit that it also works around a problem when the API would return an error if the user happens to belong to an organization that has IP allow list enabled. From our GraphQL docs: > `affiliations`: Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns. > > `ownerAffiliations`: Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns. --- pkg/cmd/repo/list/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/repo/list/http.go b/pkg/cmd/repo/list/http.go index 191ba0d18..00190ecbb 100644 --- a/pkg/cmd/repo/list/http.go +++ b/pkg/cmd/repo/list/http.go @@ -80,7 +80,7 @@ func listRepos(client *http.Client, hostname string, limit int, owner string, fi query := fmt.Sprintf(`query RepositoryList(%s) { %s { login - repositories(first: $perPage, after: $endCursor, privacy: $privacy, isFork: $fork, ownerAffiliations: OWNER, orderBy: { field: PUSHED_AT, direction: DESC }) { + repositories(first: $perPage, after: $endCursor, privacy: $privacy, isFork: $fork, affiliations: OWNER, orderBy: { field: PUSHED_AT, direction: DESC }) { nodes{%s} totalCount pageInfo{hasNextPage,endCursor}