The ghouls can help you.
yarn global add ghouls
Create ~/.config/ghouls.config.json
:
{
"username": "github-username",
"token": "github-personal-access-token",
"baseUrl": "https://ghe.local/api/v3"
}
Run: ghouls prunePullRequests --dry-run myorg/myrepo
$ ghouls prunePullRequests myorg/myrepo
#1871 - Deleting remote: heads/fix/fe-nits
#1821 - Deleting remote: heads/fix/collaborator-search
#1799 - Deleting remote: heads/fix-yarn-for-1.24
#1758 - Skipping remote: heads/ml/search-polish (mismatched refs)
...