One well-known problem in nixpkgs is how long it takes to get a review on some PRs. Though the average PR is merged in under a day, this average PR probably comes from the r-ryantm bot, not a human. Human PRs meanwhile can take weeks to get attention.
In the meantime, some PRs get merged, and this can lead to merge conflicts if my PR has touched the same files as a merged PR. And by the time my PR gets attention, it gets a comment about the conflict, then forgotten again for many more weeks. And if no one comments, I didn’t even know about it.
So, I wanted to be more proactive about tracking such PRs, and came up with the following query.
gh api graphql -f query='{
user(login: "USERNAME") {
pullRequests(last: 100, states: OPEN) {
edges {
node {
number
url
baseRefName
headRefName
mergeable
isDraft
}
}
}
}
}' | jq '.data.user.pullRequests.edges[] | select(.node.mergeable != "MERGEABLE")'
This requires prior authentication with the gh
CLI, and jq
on path as well.
Replace USERNAME
of course, and I hope you don’t have over 100 open PRs…
Also, if you see a bunch of PRs with UNKNOWN
mergeable status, rerun the query. I don’t know why this happens.