I have the results of a Github Commandline call with the following JSON format:
[
{
"name": "repository-1",
"pullRequests": {
"totalCount": 129
}
},
{
"name": "repository-2",
"pullRequests": {
"totalCount": 1143
}
},
{
"name": "repository-3",
"pullRequests": {
"totalCount": 78
}
},
{
"name": "repository-4",
"pullRequests": {
"totalCount": 0
}
}
]
This is the output of gh repo list ORG-REPO --json pullRequests,name
I have many many more repositories in there and my goal is to get a list of all repositories that have 0 pull requests so that I can act on those (archive).
How can I do this utilizing jq
?
I've tried:
.[].pullRequests.totalCount -> This gives me the numeric value of each record
.[].pullRequests.totalCount,.[].name -> This gives me the list from above and then the list of repository names
How can I filter the list of repositories to only show the repository name where pullRequests.totalCount = 0