3

I'm trying to list collaborators for all repos in an organization. My query looks like this.

    query($login: String!, $cursor: String) {
        organization(login: $login) {
            url
            login
            repositories(first: 100, after: $cursor) {
                pageInfo {
                    endCursor
                    hasNextPage
                }
                nodes {
                    name
                    collaborators(affiliation: OUTSIDE, first: 100) {
                        edges {
                            permission
                        }
                        nodes {
                            url
                            login
                            name
                            email
                            company
                        }
                    }
                }
            }
        }
    }

This works fine in the GraphQL Explorer. No permissions errors as my user has the necessary permissions.

However if I try to do this from the GraphQL API endpoint directly, I get:

[
  {
    "type": "FORBIDDEN",
    "path": [
      "organization",
      "repositories",
      "nodes",
      0,
      "collaborators"
    ],
    "locations": [
      {
        "line": 18,
        "column": 21
      }
    ],
    "message": "Must have push access to view repository collaborators."
  },

I have given my personal access token all possible scopes to debug, the issue persists.

Since my user is org admin and can list all collaborators from the GraphQL Explorer, I would expect this to work.

dbzuk
  • 235
  • 2
  • 9

1 Answers1

0

I have given my personal access token all possible scopes to debug, the issue persists.

Nevertheless, if you don't have push/write access to those repositories, you would get that error message, irrespective of the scopes you gave to your token.
(as illustrated here)

See also isaacs/github issue 444 for confirmation.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250