github graphQL api – how to retrieve issue’s project items?

github graphQL api – how to retrieve issue’s project items?


0

I am new to github graphQL API and I have been scrambling for a solution to the following problem, using github Entreprise Cloud:

  • I have a repo "myRepo" containing an issue "myIssue"
  • issue "myIssue" is added to a projectV2 "myProject", which is defined at organization level (not in a repo)
  • project "myProject" contains a field "Status" (default field when creating projects)

Now, I want to automate a re-opening of the issue when it is closed via a merged PR, if the value of the "status" of the issue in the project "myProject" is not "Closed".

Question is: having the node id of issue "myIssue", how can I retrieve the value of the field "status" for that issue in project "myProject" (assuming I have either the project number or its node id) with a graphQL query?

tried something like

query findProjectItemsForIssueNumber($owner: String!, $repoName: String!, $issueNumber:Int!) {
  viewer {
    organization(login:$owner) {
      repository(name:$repoName) {
        issue(number:$issueNumber) {
          url
          projectItems(first:20) {
            nodes {
              id
            }
          }
        }
      }
    }
  }
}

but projectItems is not an Issue field

New contributor

sepollig is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


Load 3 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *