[Solved] How do you return Issue from a ProjectCardItem?

schema-request

#1

My Obstacle is currently at the bottom of this thread

I am building in the ability to have swimlanes for my github projects.
I want to get all possible issues inside of current github’s repo Project.

As I understand it, issues is an IssueConnection.
I see it has states:ENUM. I thought maybe there was someplace documented to
see what other arguments I could pass or the Explorer would expose these options but my attempt to find this has fruitless.

So this is the query I have been working with

repository(owner:"omenking", name:"swimmer") {
  issues(last:20, states:OPEN) {
    edges {
      node {
        title
        url
        labels(first:5) {
          edges {
            node {
              name
}}}}}}}

If I were to think how I would to this I would guess:

repository(owner:"omenking", name:"swimmer") {
  issues(last:100, states:OPEN, project_id:123 ) {
    edges {
      node {
        title
        url
        labels(first:5) {
          edges {
            node {
              name
}}}}}}}

Or I would guess I might have to use search

search(query:"is:issue",type:ISSUE,last:100, repo_id: 123, project_id: 123) {
  edges {
    node {
      ... on Issue {
        title
        assignees(last:100) {
          edges {
            node {
              login
}}}}}}}

How do I get only issues back from a github’s project?
How do I find a list of arguments eg. states:ENUM?


#2

I appear to be getting closer to my solution:

However this code does not work Its my understanding I will have to go through the columns to get the cards to get the issues.

query{
  repository(owner:"omenking", name:"swimmer"){
	  project(number:1) {
	    columns(first: 100){
        cards(first: 100){
          node{
            content  
          }
        }
}}}}     

#3

Even closer. Now my issue is that ProjectCardItem can be of two types. Issue or Note, uncertain how to get that data.

query{
  repository(owner:"omenking", name:"swimmer"){
	  project(number:1) {
	    columns(first: 100){
        edges {
          node {
		        cards(first: 100){
	            edges {
	              node{
	                content{
                    __typename                    
                  }  
	            }}
		      	}            
}}}}}}    

#4

:wave: Hi @omenking,

ProjectCardItem is a union of two types: Issue or PullRequest. When querying a union, you must use an inline fragment to get the data on the underlying type.

I think this query might have the information that you’re looking for:

{
  repository(owner: "omenking", name: "swimmer") {
    project(number: 1) {
      columns(first: 100) {
        edges {
          node {
            cards(first: 100) {
              edges {
                node {
                  note
                  state
                  content {
                    ... on Issue {
                      title
                    }
                    ... on PullRequest {
                      title
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Hope this helps,
Brooks


#5

This was exactly what I was looking for thanks Brooks!