How to query GraphQL for all Issues in a column with state=closed?

I have a GitHub project with hundreds of cards a column named Done.  I would like to do two things:

1.  Find all open issues in the Done column and close them.

  1. Find all closed issues in the  Done column and archive them.

Can GraphQL support finding all issues in a column which are open?

The closest thing I got is a query like this:

query {
  organization(login:"org") {
    project(number:3) {
      columns(first:1){
        nodes{
          id,
          name,
          cards(first:1){
            nodes{
              content {
                ... on Issue {
                  url,
                  state
                }
              }
            }
          }
        }
      }
    }
  }
}

Which yields a response like this:

{
  "data": {
    "organization": {
      "project": {
        "columns": {
          "nodes": [
            {
              "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
              "name": "On Deck",
              "cards": {
                "nodes": [
                  {
                    "content": {
                      "url": "https://github.com/org/repo/issues/606",
                      "state": "OPEN"
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    }
  }
}

For the record, this is the same question as the currently unanswered Querying github project cards with graphql.

The way that the GraphQL API is currently built, no, you can’t filter project cards on the state of the issue that they’re representing using only the query language. You would have to query all cards in the column and then filter it yourself.

I hope that helps!

1 Like