Skip to content

Commit

Permalink
DevTools pre-filter GH issues by repo (#21292)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn authored Apr 15, 2021
1 parent cc4b431 commit c1a53ad
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,24 @@ export async function searchGitHubIssues(
message = message.replace(/"[0-9]+"/, '');

const filters = [
// Unfortunately "repo" and "org" filters don't work
// Hopefully the label filter will be sufficient.
'in:title',
'is:issue',
'is:open',
'is:public',
'label:"Component: Developer Tools"',
'repo:facebook/react',
];

const octokit = new Octokit();
const {data} = await octokit.search.issuesAndPullRequests({
q: message + ' ' + filters.join(' '),
});

const maybeItem = data.items.find(item =>
item.html_url.startsWith('https://github.com/facebook/react/'),
);

if (maybeItem) {
if (data.items.length > 0) {
const item = data.items[0];
return {
title: maybeItem.title,
url: maybeItem.html_url,
title: item.title,
url: item.html_url,
};
} else {
return null;
Expand Down

0 comments on commit c1a53ad

Please sign in to comment.