@@ -35,8 +35,8 @@ async function init(): Promise<void> {
3535
3636 if ( tagName ) {
3737 addExistingTagLink ( tagName ) ;
38- } else if ( canCreateRelease ( ) ) {
39- void addLinkToCreateRelease ( 'This pull request seems to be unreleased ' ) ;
38+ } else {
39+ void addReleaseBanner ( 'This pull request has not yet appeared in a release ' ) ;
4040 }
4141}
4242
@@ -76,14 +76,16 @@ function addExistingTagLink(tagName: string): void {
7676 } ) ;
7777}
7878
79- async function addLinkToCreateRelease ( text = 'Now you can release this change' ) : Promise < void > {
80- if ( await getReleaseCount ( ) > 0 ) {
79+ async function addReleaseBanner ( text = 'Now you can release this change' ) : Promise < void > {
80+ if ( await getReleaseCount ( ) === 0 ) {
8181 return ;
8282 }
8383
84- const url = isRefinedGitHubRepo ( )
85- ? 'https://github.com/refined-github/refined-github/actions/workflows/release.yml'
86- : buildRepoURL ( 'releases/new' ) ;
84+ const url = canCreateRelease ( ) ? (
85+ isRefinedGitHubRepo ( )
86+ ? 'https://github.com/refined-github/refined-github/actions/workflows/release.yml'
87+ : buildRepoURL ( 'releases/new' )
88+ ) : undefined ;
8789 attachElement ( {
8890 anchor : '#issue-comment-box' ,
8991 before : ( ) => (
@@ -99,6 +101,7 @@ async function addLinkToCreateRelease(text = 'Now you can release this change'):
99101}
100102
101103void features . add ( import . meta. url , {
104+ // When arriving on an already-merged PR
102105 asLongAs : [
103106 pageDetect . isPRConversation ,
104107 pageDetect . isMergedPR ,
@@ -109,6 +112,7 @@ void features.add(import.meta.url, {
109112 deduplicate : 'has-rgh-inner' ,
110113 init,
111114} , {
115+ // This catches a PR while it's being merged
112116 asLongAs : [
113117 pageDetect . isPRConversation ,
114118 pageDetect . isOpenPR ,
@@ -120,16 +124,14 @@ void features.add(import.meta.url, {
120124 onlyAdditionalListeners : true ,
121125 deduplicate : false ,
122126 init ( ) {
123- void addLinkToCreateRelease ( ) ;
127+ void addReleaseBanner ( ) ;
124128 } ,
125129} ) ;
126130
127131/*
128-
129- # Test URLs
132+ Test URLs
130133
131134- PR: https://github.com/refined-github/refined-github/pull/5600
132135- Locked PR: https://github.com/eslint/eslint/pull/17
133136- Archived repo: https://github.com/fregante/iphone-inline-video/pull/130
134-
135137*/
0 commit comments