Get more details of author with get issues

community-help

#1

With get Issues, I get back type Author, but what I am looking for is details present in type User. Same requirement with comments.

Is there a way to fetch the User info with a single get all issues query?

I did look at the participants User connection which gives everyone who is associated with the issue and there is no way to map those who commented vs who created the issue.

My current query

{
  repository(owner: "bsreera", name: "somerepo") {
    issues(first: 10) {
      totalCount
      edges {
        node {
          number
          title
          url
          body
          author {
            login
          }
          labels(first: 10) {
            edges {
              node {
                name
              }
            }
          }
          comments(first: 10) {
            totalCount
            edges {
              node {
                author {
                  login
                }
                body
              }
            }
          }
          reactions(first: 10, content: THUMBS_UP) {
            totalCount
          }
        }
      }
    }
  }
}

#2

You can spread the Actor interface returned by the author field into a User object via a fragment:

{
  repository(owner: "jquery", name: "jquery") {
    issues(first: 10) {
      edges {
        node {
          author {
            ... on User {
              name
              bio
            }
          }
        }
      }
    }
  }
}

Note, however, you’ll get null for name/bio/etc if the Actor that created the issue was not a User (e.g. it was created by an App Bot).

Hope this helps!


#3

Cool, thanks