diff options
| author | Joe Mou <dev@mou.fo> | 2026-05-27 14:02:36 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-05-27 23:37:23 -0400 |
| commit | 96396c4ed853652ea311d006b4ebe6af15b40684 (patch) | |
| tree | 84ed30e17bc2232ac755f9d488a30d8aec233577 /src/scraper.ts | |
| parent | 12a072ded4d8528296bcf9fde6ae8324588da97e (diff) | |
Add repo-scoped search support for issues and PRs
We do not support hybrid issue/PR search. Any searches on the issues
endpoint will redirect to an explicit issue-only search.
Diffstat (limited to 'src/scraper.ts')
| -rw-r--r-- | src/scraper.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/scraper.ts b/src/scraper.ts index 04a685b..2412e49 100644 --- a/src/scraper.ts +++ b/src/scraper.ts @@ -258,6 +258,7 @@ interface Issue { export interface GitHubIssues extends GitHubCommon { issues: Issue[]; + q?: string; } export interface GitHubCommits extends GitHubNav { @@ -513,9 +514,14 @@ export async function getGitHubBlob( }); } -export async function getGitHubIssues(owner: string, repo: string): Promise<GitHubIssues> { - const html = await fetchGitHubPage(`${owner}/${repo}/issues`); - +export async function getGitHubIssues( + owner: string, + repo: string, + // We only support is:issue searches (no PR results). + { q }: { q?: string } = {}, +): Promise<GitHubIssues> { + const suffix = q ? `?q=${encodeURIComponent(q)}` : ""; + const html = await fetchGitHubPage(`${owner}/${repo}/issues${suffix}`); const payload = parsePayload(html); let issuesQuery: IssueIndexPageQuery | undefined; @@ -534,13 +540,7 @@ export async function getGitHubIssues(owner: string, repo: string): Promise<GitH return { number, title: finalTitle, state, createdAt }; }); - return { - repo: { - owner, - name: repo, - }, - issues, - }; + return { repo: { owner, name: repo }, issues, q }; } export async function getGitHubCommits( |
