Getting whether an Issue is an epic

I’d like to know if there is a way to find out whether a specific Issue is an Epic Issue using the GraphQL api.
I was able to use the following query to find out if the issue belongs to an epic.
But no whether the issue itself is an epic or not.

const getIssueDescriptionQuery = `
query getIssueInfo($issueNumber: Int!, $repositoryGhId: Int!) {
  issueByInfo(repositoryGhId: $repositoryGhId, issueNumber: $issueNumber) {
    id
    repository {
      id
      ghId
    }
    number
    title
    body
    state
    parentEpics(first: 5) {
      nodes {
        id
      }
    }
  }
}
`

Trying to create a tool for myself to easily add issues to an epic from cli, but I’m having difficulty getting a specific Epic Id in order to use the addIssuesToEpics mutation.

Thanks

Hi there,

Great question!

What I think you’re looking for would be be the epic field. This field is deprecated in favour to ZenhubEpics, but if you seem to be using our older version of epics, this is the field to check.

The query would be something like this:
query getIssueInfo($issueNumber: Int!, $repositoryGhId: Int!) {
issueByInfo(repositoryGhId: $repositoryGhId, issueNumber: $issueNumber) {
epic { id }
}
}

Cheers,

Olivia

1 Like