GraphQL API Issues FilterBy not working on milestones

Like the title suggests, the GraphQL issues filterBy function doesn’t seem to work with milestones. No idea if this is due to me writing it incorrectly or an actual bug. Anyway here is my query:

query issues {
  repository(owner: "facebook", name: "react") {
    issues(filterBy: {
      milestone:"40"
    }, first: 100){
      nodes{
        title
        body
        author {
          login
        }
        number
        milestone {
          number
          title
        }
        state
      }
    }
  }
}

Testing on say a very popular public repo like react: https://github.com/facebook/react/

and on this specifc milestone: https://github.com/facebook/react/milestone/40 doesn’t work for some reason. Typing in both null and "*" will give me issues with no milestone and all issues with an associated milestone, but trying to narrow that down to specific milestones does not work. Am I doing something wrong because the only response I get is this:

{
  "data": {
    "repository": {
      "issues": {
        "nodes": []
      }
    }
  }
}
2 Likes

Hi @blackglade,

Thanks for being here, at first glance I think the issue is the field author does not exist under milestone would you give this a try:

{
 repository(owner: "facebook", name: "react") {
    milestone(number:40) {
      issues(last:10) {
        edges {
          node {
            title
            author {
              login
            }
          }
        }
      }
    }
  }
}

Hi Andrea,

Yes your query worked, but it is completely different than the original query I posted which is trying to apply a filter of a milestone as a parameter to the issues graphql instead of finding all issues under a milestone. That being said, even after I removed the author field from my original query, I still got a blank response. 

Hi@blackglade 

Yes it is not working with the milestone number but it is working with the id.

First i called this api to get all the milestones

https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository

And then with that i got the id of the milestone and replaced that in GraphQL i can get the result set.

See the below screenshot to get the milestone api

See the below screenshot to  get the issue list from GraphQL.

I am not sure wether the documentation is not clear or there is issue with the api. If you look  at the right side of the screenshot in documentation it is mentioned as number only.

Hope this helps your query

HI @parithiban,

Thanks for responding. This is a little strange. So your query definitely worked, but I am little unsure how that id is being generated as when I try to get the id for milestone 40, I get this value: MDk6TWlsZXN0b25lMjkzNzc1Ng==

See screenshot:

Why is v3 and v4 returning two different ID’s

Hi @blackglade 

Yes as you mentioned it is different in both V3 and V4 api. Not sure where these are well documented.

Ok so if you still need only to get the issues by the milestone number try with the below query

{
	repository(owner: "facebook", name: "react") {
		milestone(number: 40) {
			number
			id
			issuePrioritiesDebug
			url
			issues(first: 100) {
				nodes {
					title
					number
				}
			}
		}
	}
}

Also see the below screenshot you can see the milestone_id parameter where this is the id(V3 API) that is mentioned in the previous comment

Hi @parithiban ,

Thank you for replying! I did not realize ussuePrioritiesDebug was an option available and definitely has solved my issue in the short term. That being said, this is clearly an issue with documentation and Github’s own implementation of it’s API. I have reached out to support and will update this thread when I get a response back. Thank you soo much for your help in the mean time!