4

The end result is I am trying to start with an issue number (tied to an issue card on a project) and programmatically move it to a different column.

I've found this endpoint POST /projects/columns/cards/{card_id}/moves moves the card. This requires the ID of the card.

So I'm looking for a clean way to start with an issue number and get the card id for the card connected to that issue.

Each card object has the content_url field which seems to be what makes a card an "issue card", however there is no way shown in the documentation to try to search for a card with a specific content_id.

Of course, I can just request the GET /projects/columns/{column_id}/cards endpoint to get a list of all the cards in the column and iterate through until I find one that has a content_id that matches the url for the issue, but I'm wondering if there is another way.

nmajor
  • 497
  • 4
  • 10

1 Answers1

1

you can use GitHub GraphQL API.

query='query {
  repository(owner: "owner", name: "repo") {
    issue(number: 1234) {
      projectCards {
        nodes {
          databaseId
        }
      }
    }
  }
}'

# you don't need to use GitHub CLI, curl is enough
gh api graphql -f query=$query