GraphQL API Retrieve event history text of issue

I have the following query:

query issues($org: String!, $repo: String!) {
  repository(owner: $org, name: $repo) {
    issues(first: 77){
      nodes{
        number
        timelineItems(itemTypes:[ADDED_TO_PROJECT_EVENT, MOVED_COLUMNS_IN_PROJECT_EVENT], first: 100){
          nodes {
            __typename
            ... on AddedToProjectEvent{
              id
              actor {
                login
              }
            }
          }
        }
      }
    }
  }
}

I basically have a project board setup with several columns and want to capture the issues as they move throughout the column. How do I retrieve the event history of what columns each moves to and from. This query will only give me the event and the id/author of the event, but not details about the event (ie: which column in the project board it was moved to).

You can use the following query:

query issues($org: String!, $repo: String!) {
  repository(owner: $org, name: $repo) {
    issues(last: 100){
      nodes{
        number
        timelineItems(itemTypes:[ADDED_TO_PROJECT_EVENT, MOVED_COLUMNS_IN_PROJECT_EVENT], first: 100){
          nodes {
            __typename
            ... on AddedToProjectEvent{
              id
              actor {
                login
              }
            }
            ... on MovedColumnsInProjectEvent {
              id
              previousProjectColumnName
              projectColumnName
            }
          }
        }
      }
    }
  }
}

As stated in the documentation, you have to enable the preview feature for those particular fields to be available on MovedColumnsInProjectEvent.

I hope that helps!

2 Likes

Thanks this helps a lot!