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

API v4 GraphQL | Retrieve if PR has "Changes Requested" or "Review Required"

Hi everyone! 

 

I'm using Github API v4 to retrieve all PRs from an user and then filtering and formating them to send a message to Slack. Like a "check your prs" reminder.

 

I need to get if the PR has, and I don't know how it's called, "Changes Requested" or "Review Required" in it. Is there a way to get it? I couldn't find a field that gives me that.

 

This is my query (also it would be nice if someone with more expertise than me in GraphQL could tell me if my query is fine or could be improved)

 

query GET_PRS($from: String!) {
        user(login: $from) {
          repositories(first: 100) {
            edges {
              node {
                name
                pullRequests(first: 100, states: OPEN) {
                  edges {
                    node {
                      createdAt
                      headRefName
                      permalink
                      state
                      number
                      updatedAt
                      lastEditedAt
                      repository {
                        name
                      }
                      labels(first: 1) {
                        edges {
                          node {
                            name
                          }
                        }
                      }
                      author {
                        login
                      }
                      title
                      assignees(first: 10) {
                        edges {
                          node {
                            name
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }

Thanks!

2 Replies
Community Manager
Message 2 of 3

Re: API v4 GraphQL | Retrieve if PR has "Changes Requested" or "Review Required"

Hi @taltrui,

 

Thanks for being here. The field you are looking is:

requestedReviewer {
                ... on User {

 

Just for general info, have you checked out https://pullreminders.com/


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 3

Re: API v4 GraphQL | Retrieve if PR has "Changes Requested" or "Review Required"

Hi, @AndreaGriffiths11!

 

Great! Thanks, and what about the "Changes Requested" tag? is there a way to retrieve it?

 

I've tried Pull Panda but it's only available for organizations while the focus of my tool is normal users repos.

 

Again, thank you!