Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Last active April 29, 2024 00:26
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfatehi/ff12772c852da1fe8a2c88a5e3f1bfb3 to your computer and use it in GitHub Desktop.
Save kfatehi/ff12772c852da1fe8a2c88a5e3f1bfb3 to your computer and use it in GitHub Desktop.
list pull requests across entire organization
var Promise = require('bluebird')
var GitHubApi = require("github");
const org = "matrix-hacks";
var github = new GitHubApi({ Promise });
github.repos.getForOrg({ org, type: 'sources' })
.then(res=>res.data.map(i=>i.name))
.then(repos=>{
return Promise.map(repos, (repo) => {
return github.pullRequests.getAll({
state: 'open',
owner: org,
repo
});
})
})
.then((allReposPrs) => {
allReposPrs.forEach(thisRepoPrs=>{
thisRepoPrs.data.forEach(pr => {
const {
_links,
title,
body,
created_at,
updated_at,
user: { login },
number,
} = pr;
const baseName = pr.base.repo.name;
console.log([
`Pull request`,
`\tRepo: ${pr.base.repo.name}`,
`\tAuthor: ${login}`,
`\tTitle: ${title}`,
`\tURL: ${_links.html.href}`,
].join('\n'));
});
})
});
@Chekote
Copy link

Chekote commented Aug 14, 2020

You can also do this via the website by using:

https://github.com/pulls?q=is%3Aopen+is%3Apr+user%3AORG+archived%3Afalse+

Replacing ORG with the desired org name.

@FacundoDedalord
Copy link

You can also do this via the website by using:

https://github.com/pulls?q=is%3Aopen+is%3Apr+user%3AORG+archived%3Afalse+

Replacing ORG with the desired org name.

This was what I was looking for, thanks! 👍

@jeremywadsack
Copy link

jeremywadsack commented Mar 3, 2021

You can also do this via the website by using:

https://github.com/pulls?q=is%3Aopen+is%3Apr+user%3AORG+archived%3Afalse+

Replacing ORG with the desired org name.

Or more simply:

https://github.com/pulls?user=ORG

@Chekote
Copy link

Chekote commented Mar 6, 2021

@jeremywadsack Nice 👏. I didn't know it would only show open PRs by default.

@qz267
Copy link

qz267 commented Sep 17, 2022

https://github.com/pulls?user=ORG

+1

@gwillem
Copy link

gwillem commented Dec 15, 2022

Thank you!

@jd-brennan
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment