Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 5

GraphQL repo issues has no `closedBy` field

While running queries against repository `issues` I cannot find a field for events that includes a `closedBy` attribute (https://developer.github.com/v4/object/closedevent/).

4 Replies
Community Manager
Message 2 of 5

Re: GraphQL repo issues has no `closedBy` field

Hey @reka18,

 

Thanks for being here! The Actor field should show this. Are you able to post a sample of your results? If needed to be private please contact us at https://github.com/contact and we'll take a look.

Thanks for being here, sharing, and keeping our community awesome!
Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 3 of 5

Re: GraphQL repo issues has no `closedBy` field

query { 
  viewer { 
    repository(name: "<name-of-repo-here"){
      issues(states: CLOSED, first:10){
        edges{
          node{
            boody
          }
        }
      }    
    }
  }
}

When I press the CTRL + SPACE to see available options, I cannot see the actor field.

Copilot Lvl 2
Message 4 of 5

Re: GraphQL repo issues has no `closedBy` field

I think what @reka18 meant was that the Issue Object doesn't have a ClosedEvent field which actually has the Actor field with the user details.

The v3 API has a `closed_by` field present.

 

 

Copilot Lvl 2
Message 5 of 5

Re: GraphQL repo issues has no `closedBy` field

I ended up contacting Github support and they provided a solution:

 


Have you tried using the timelineItems connection, using an approach similar to this:

https://github.community/t5/GitHub-API-Development-and/Filtering-on-v4-GraphQL-issue-sub-nodes/m-p/2...

There's a CLOSED_EVENT that's available through that:

https://developer.github.com/v4/enum/issuetimelineitemsitemtype/#issuetimelineitemsitemtype



 

So the query becomes something like:

 

query commits{
  repository(owner: "rohit-smpx", name:"inno"){
    issues(first: 10, states:CLOSED){
      nodes{
        number
        title
        timelineItems(itemTypes:CLOSED_EVENT, last: 1){
          nodes{
            __typename
            ...on ClosedEvent{
              actor{
                login
              }
              createdAt
            }
          }
        }
      }
    }
  }
}

 

Thanks Ivan for the response.