@@ -22,12 +22,14 @@ const getCurrentActiveURL = async () =>{
2222const isGitHubIssueUrl = ( url ) => {
2323
2424 if ( url === null ) {
25- url = window . location . href ;
26- }
27-
28- let pattern = / ^ ( h t t p s ? : \/ \/ ) g i t h u b \. c o m \/ .+ \/ .+ \/ i s s u e s \/ \d + / i;
29-
30- return pattern . test ( url ) ;
25+ url = window . location . href ;
26+ }
27+
28+ const issueUrlPattern = / ^ ( h t t p s ? : \/ \/ ) g i t h u b \. c o m \/ .+ \/ .+ \/ i s s u e s \/ \d + / i;
29+
30+ const projectIssueUrlPattern = / ^ h t t p s : \/ \/ g i t h u b .c o m \/ ( o r g s | u s e r s ) \/ (?< owner > \w + ) \/ p r o j e c t s \/ \d + (?: .* ) (?: [ ? | & ] p a n e = \S + & * ) (?: i s s u e = \S + ) / i;
31+
32+ return issueUrlPattern . test ( url ) || projectIssueUrlPattern . test ( url ) ;
3133}
3234
3335const isGitHubPullRequestUrl = ( url ) => {
@@ -58,13 +60,23 @@ const getGitHubOwner = (url) => {
5860 url = window . location . href ;
5961 }
6062
61- const expression = / h t t p s : \/ \/ g i t h u b .c o m \/ (?< owner > [ ^ \/ ] + ) ? ( . * ) / i
63+ const issueOrPrOwnerPattern = / h t t p s : \/ \/ g i t h u b .c o m \/ (?< owner > [ \w ] + ) \/ \w + \/ ( p u l l | i s s u e s ) \/ . + / i
6264
63- const matches = url . match ( expression ) ;
65+ if ( issueOrPrOwnerPattern . test ( url ) ) {
66+
67+ const matches = url . match ( issueOrPrOwnerPattern ) ;
6468
65- const owner = matches ?. groups [ 'owner' ] ;
69+ return matches ?. groups [ 'owner' ] ;
70+ }
6671
67- return owner ;
72+ const projectIssuetOwnerPattern = / h t t p s : \/ \/ g i t h u b .c o m \/ ( o r g s | u s e r s ) \/ (?< owner > \w + ) \/ p r o j e c t s \/ \d + (?: .* ) (?: [ ? | & ] p a n e = \S + & * ) (?: i s s u e = \S + ) / i
73+
74+ if ( projectIssuetOwnerPattern . test ( url ) ) {
75+
76+ const matches = url . match ( projectIssuetOwnerPattern ) ;
77+
78+ return matches ?. groups [ 'owner' ] ;
79+ }
6880}
6981
7082const canLoadRepliesForUrl = ( config , url ) => {
0 commit comments