From f9a97ac4360912640e613aa340af7d7a3f6450c0 Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 14 Apr 2026 20:37:09 +0500 Subject: [PATCH 01/10] isPRList - Support global PR list subpaths --- index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 8f24f21..ab88aa3 100644 --- a/index.ts +++ b/index.ts @@ -318,10 +318,11 @@ TEST: addTests('isPRConflicts', [ ]); /** Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */ -export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/pulls' || getRepo(url)?.path === 'pulls'; +export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname.startsWith('/pulls') || isRepoPRList(url); TEST: addTests('isPRList', [ 'https://github.com/pulls', 'https://github.com/pulls?q=issues', + 'https://github.com/pulls/review-requested', 'https://github.com/sindresorhus/refined-github/pulls', 'https://github.com/sindresorhus/refined-github/pulls/', 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr', From 4255861750d55441905a9bb1a198c8ef481350c7 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:19:15 +0500 Subject: [PATCH 02/10] changes --- index.ts | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/index.ts b/index.ts index ab88aa3..73ef330 100644 --- a/index.ts +++ b/index.ts @@ -183,19 +183,28 @@ TEST: addTests('isGist', [ 'https://gist.my-little-hub.com/in-fragrante', ]); -export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => ['issues', 'pulls'].includes(url.pathname.split('/', 2)[1]!); -TEST: addTests('isGlobalIssueOrPRList', [ +export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'issues'; +TEST: addTests('isGlobalPRList', [ 'https://github.com/issues', - 'https://github.com/issues?q=is%3Apr+is%3Aopen', 'https://github.com/issues/assigned', 'https://github.com/issues/mentioned', + 'https://github.com/issues?q=is%3Apr+is%3Aopen', + 'https://github.com//issues/', +]); + +export const isGlobalPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'pulls'; +TEST: addTests('isGlobalPRList', [ 'https://github.com/pulls', - 'https://github.com/pulls?q=issues', 'https://github.com/pulls/assigned', 'https://github.com/pulls/mentioned', 'https://github.com/pulls/review-requested', + 'https://github.com/pulls?q=issues', + 'https://github.com//pulls/', ]); +export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalIssueList(url) || isGlobalPRList(url); +TEST: addTests('isGlobalIssueOrPRList', combinedTestOnly); + export const isGlobalSearchResults = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/search' && new URLSearchParams(url.search).get('q') !== null; TEST: addTests('isGlobalSearchResults', [ 'https://github.com/search?q=refined-github&ref=opensearch', @@ -318,16 +327,8 @@ TEST: addTests('isPRConflicts', [ ]); /** Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */ -export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname.startsWith('/pulls') || isRepoPRList(url); -TEST: addTests('isPRList', [ - 'https://github.com/pulls', - 'https://github.com/pulls?q=issues', - 'https://github.com/pulls/review-requested', - 'https://github.com/sindresorhus/refined-github/pulls', - 'https://github.com/sindresorhus/refined-github/pulls/', - 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr', - 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Apr+is%3Aclosed', -]); +export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalPRList(url) || isRepoPRList(url); +TEST: addTests('isPRList', combinedTestOnly); export const isPRCommit = (url: URL | HTMLAnchorElement | Location = location): boolean => /^pull\/\d+\/(commits|changes)\/[\da-f]{7,40}$/.test(getRepo(url)?.path); TEST: addTests('isPRCommit', [ @@ -459,7 +460,7 @@ TEST: addTests('isRepo', [ // Some of these are here simply as "gotchas" to other detections 'https://github.com/sindresorhus/refined-github/blame/master/package.json', 'https://github.com/sindresorhus/refined-github/issues/146', - 'https://github.com/sindresorhus/notifications/', + 'https://github.com/sindresorhus/notifications/', // Gotcha for isNotifications 'https://github.com/sindresorhus/refined-github/pull/148', 'https://github.com/sindresorhus/refined-github/milestones/new', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList @@ -792,6 +793,8 @@ TEST: addTests('isProfile', [ 'https://github.com/sindresorhus?tab=followers', 'https://github.com/fregante?tab=following', 'https://github.com/sindresorhus?tab=following', + 'https://github.com/pullsuser', // Gotcha for isGlobalPRList + 'https://github.com/issuesuser', // Gotcha for isGlobalIssueList ]); export const isGistProfile = (url: URL | HTMLAnchorElement | Location = location): boolean => doesLookLikeAProfile(getCleanGistPathname(url)); From 928344defcab0cb3a279951b13e51278624183f5 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:25:04 +0500 Subject: [PATCH 03/10] oops --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 73ef330..bab91bb 100644 --- a/index.ts +++ b/index.ts @@ -184,7 +184,7 @@ TEST: addTests('isGist', [ ]); export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'issues'; -TEST: addTests('isGlobalPRList', [ +TEST: addTests('isGlobalIssueList', [ 'https://github.com/issues', 'https://github.com/issues/assigned', 'https://github.com/issues/mentioned', From 6d97ff16fc07bebc7ddf23fe46f702b5978835cb Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:39:42 +0500 Subject: [PATCH 04/10] =?UTF-8?q?fix=20`isGlobalIssueList`=20&=20`isGlobal?= =?UTF-8?q?PRList`=20=F0=9F=A4=A6=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index bab91bb..4d57d08 100644 --- a/index.ts +++ b/index.ts @@ -183,7 +183,7 @@ TEST: addTests('isGist', [ 'https://gist.my-little-hub.com/in-fragrante', ]); -export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'issues'; +export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^issues($|\/)/.test(getCleanPathname(url)); TEST: addTests('isGlobalIssueList', [ 'https://github.com/issues', 'https://github.com/issues/assigned', @@ -192,7 +192,7 @@ TEST: addTests('isGlobalIssueList', [ 'https://github.com//issues/', ]); -export const isGlobalPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'pulls'; +export const isGlobalPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^pulls($|\/)/.test(getCleanPathname(url)); TEST: addTests('isGlobalPRList', [ 'https://github.com/pulls', 'https://github.com/pulls/assigned', From f0e50cfa18bfb7bc8cf377fff82a3e3e9e5adca1 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:41:46 +0500 Subject: [PATCH 05/10] add gotchas for `isRepoPRList` & `isRepoIssueList` --- index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.ts b/index.ts index 4d57d08..dd25528 100644 --- a/index.ts +++ b/index.ts @@ -466,6 +466,8 @@ TEST: addTests('isRepo', [ 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList 'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList + 'https://github.com//pullsuser/my-library', // Gotcha for isRepoPRList + 'https://github.com//issuesuser/my-library', // Gotcha for isRepoIssueList ]); export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); From c2e674d4e1af07d3c3ab050afb4ec9b63e9fef2f Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:45:42 +0500 Subject: [PATCH 06/10] hopefully fix tests --- index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index dd25528..7773b30 100644 --- a/index.ts +++ b/index.ts @@ -466,8 +466,8 @@ TEST: addTests('isRepo', [ 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList 'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList - 'https://github.com//pullsuser/my-library', // Gotcha for isRepoPRList - 'https://github.com//issuesuser/my-library', // Gotcha for isRepoIssueList + 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList + 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList ]); export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); @@ -542,6 +542,8 @@ TEST: addTests('isRepoHome', [ 'https://github.com/sindresorhus/search', 'https://github.com/sindresorhus/branches', 'https://github.com/sindresorhus/refined-github?files=1', + 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList + 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList ]); export type RepoExplorerInfo = { From a64d1812908e3e05619fa54d91d5a19f451bab52 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 08:17:08 +0500 Subject: [PATCH 07/10] add `isIssueList` --- index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 7773b30..1009bad 100644 --- a/index.ts +++ b/index.ts @@ -215,10 +215,10 @@ TEST: addTests('isIssue', [ 'https://github.com/sindresorhus/refined-github/issues/146', ]); -export const isIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => - isGlobalIssueOrPRList(url) - || isRepoIssueOrPRList(url) - || isMilestone(url); +export const isIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoIssueList(url) || isGlobalIssueList(url) || isMilestone(url); +TEST: addTests('isIssueList', combinedTestOnly) + +export const isIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isIssueList(url) || isPRList(url); TEST: addTests('isIssueOrPRList', combinedTestOnly); export const isConversation = (url: URL | HTMLAnchorElement | Location = location): boolean => isIssue(url) || isPRConversation(url); From 3ca6fa21974acf3585079220e3cd14a7a3633fb7 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 08:19:09 +0500 Subject: [PATCH 08/10] semicolon --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 1009bad..e44167e 100644 --- a/index.ts +++ b/index.ts @@ -216,7 +216,7 @@ TEST: addTests('isIssue', [ ]); export const isIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoIssueList(url) || isGlobalIssueList(url) || isMilestone(url); -TEST: addTests('isIssueList', combinedTestOnly) +TEST: addTests('isIssueList', combinedTestOnly); export const isIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isIssueList(url) || isPRList(url); TEST: addTests('isIssueOrPRList', combinedTestOnly); From ac8b43c005ac36d7cfff1414761274e67c49da13 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 20:25:31 +0500 Subject: [PATCH 09/10] remove gotchas from isRepo --- index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.ts b/index.ts index 790638c..4f5db1f 100644 --- a/index.ts +++ b/index.ts @@ -466,8 +466,6 @@ TEST: addTests('isRepo', [ 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList 'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList - 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList - 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList ]); export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); From e27de48e3b492384b1fe78cee4e64bd1a587aabf Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 20:30:39 +0500 Subject: [PATCH 10/10] remove incorrect comments from isRepoHome gotchas --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 4f5db1f..7e3f3de 100644 --- a/index.ts +++ b/index.ts @@ -540,8 +540,8 @@ TEST: addTests('isRepoHome', [ 'https://github.com/sindresorhus/search', 'https://github.com/sindresorhus/branches', 'https://github.com/sindresorhus/refined-github?files=1', - 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList - 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList + 'https://github.com/pullsuser/my-library', + 'https://github.com/issuesuser/my-library', ]); export type RepoExplorerInfo = {