Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools pre-filter GH issues by repo #21292

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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