{
  # Queries all the issues in a repo. For each issue, we get some basic data such as
  # the number, state, labels, and title. The most important part is the 'timelineItems'
  # which are the events that happened to the issue, we can use the information about
  # the datetime about certain key events to define some metrics. Note that we are
  # getting more information than is probably needed but its fine for now.
  repository(owner: "_REPO_OWNER_", name: "_REPO_NAME_") {
    issues(first: 100) {
      totalCount
      edges {
        cursor
        node {
          number
          title
          createdAt
          state
          closedAt
          updatedAt
          url
          labels(first: 100) {
            edges {
              node {
                name
              }
            }
          }
          timelineItems(first: 100, itemTypes: [LABELED_EVENT, CONVERTED_TO_DISCUSSION_EVENT, ISSUE_COMMENT, CLOSED_EVENT]) {
            totalCount
            edges {
              node {
                __typename
                ... on ConvertedToDiscussionEvent {
                  createdAt
                }
                ... on IssueComment {
                  author {
                    login
                  }
                  createdAt
                }
                ... on ClosedEvent {
                  actor {
                    login
                  }
                  createdAt
                }
                ... on LabeledEvent {
                  label {
                    name
                  }
                  createdAt
                }
              }
            }
          }
        }
      }
    }
  }
}

