Change the owner and repo name to desired repo and get to reviewing!

Open search-open-pr in Script Kit

// Name: Search Open PRs
// Description: Search open PRs in a repo
import "@johnlindquist/kit";
const fetch = await npm("node-fetch");
const variables = {
owner: "knapsack-labs",
repoName: "app-monorepo",
};
let token = await env("GITHUB_AUTH_TOKEN", {
hint: `Grab a key from <a href="https://github.com/settings/tokens">here</a>`,
});
const query = `
query getPrs($owner: String!, $repoName: String!) {
repository(owner: $owner, name: $repoName) {
pullRequests(last: 100, states: OPEN) {
nodes {
body
createdAt
mergeable
number
state
title
updatedAt
url
author {
avatarUrl
login
}
}
}
}
}
`;
async function getPrs() {
return fetch("https://api.github.com/graphql", {
headers: {
authorization: `bearer ${token}`,
},
method: "POST",
body: JSON.stringify({ query, variables }),
})
.then((res) => res.json())
.catch((err) => {
console.log(err);
exit();
});
}
const prs = await getPrs();
const openPRs = prs.data.repository.pullRequests.nodes;
const sortedPrs = openPRs.sort(
(a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt)
);
const pr = await arg(
{
placeholder: `Select a PR to view`,
},
sortedPrs.map((pr) => {
return {
name: `${pr.number} - ${pr.title}`,
preview: () =>
`<div class="p-2">
<h2>${pr.number} - ${pr.title}</h2>
<hr class="mb-4"/>
<p>Ready to Merge: ${pr.mergeable === "MERGEABLE" ? "✅" : "⛔"}</p>
<p class="my-4">${md(pr.body)}</p>
<span class="flex flex-row">
<p>Author: ${pr.author.login}</p>
<img class="w-5 h-5 ml-2" src="${pr.author.avatarUrl}" />
</span>
</div>`,
value: pr.number,
};
})
);
const prInfo = sortedPrs.find((p) => p.number === pr);
browse(prInfo.url);