3

I am trying to fetch all my repositories that contain topic "portfolio" using Github GraphQL API.

For now, I found only how to fetch all repos on github with a specific topic, like so :

{
  search(type: REPOSITORY, query: "topic: portfolio", last: 50) {
    repos: edges {
      repo: node {
        ... on Repository {
          url
        }
      }
    }
  }
}

And I know how to fetch all repos for a specific user, like so:

{
  user(login: "VitFL") {
    repositories(last: 50) {
      repos: nodes {
        url
      }
    }
  }
}

But I have no idea how to combine those queries, so I could receive all repos with topic "portfolio" for a specific user.

Does anyone know how to achieve this result?

1 Answer 1

1

Using search(), a user argument can be added to the query value.

Also, the whitespace after the colon should be removed, i.e. topic: portfolio -> topic:portfolio. You will notice far more results with this change.

{
  search(type: REPOSITORY, query: "user:VitFL topic:portfolio", last: 50) {
    repos: edges {
      repo: node {
        ... on Repository {
          url
        }
      }
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.