Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Last active August 8, 2024 21:47
Show Gist options
  • 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'));
});
})
});
@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!

@nguythi0802
Copy link

Thank you!

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