@@ -806,6 +806,61 @@ test("Do not add comment and labels if no PR is associated with release commits"
806
806
t . true ( fetch . done ( ) ) ;
807
807
} ) ;
808
808
809
+ test ( "Do not add comment and labels if no commits is found for release" , async ( t ) => {
810
+ const owner = "test_user" ;
811
+ const repo = "test_repo" ;
812
+ const env = { GITHUB_TOKEN : "github_token" } ;
813
+ const failTitle = "The automated release is failing 🚨" ;
814
+ const pluginConfig = { failTitle } ;
815
+ const options = {
816
+ branch : "master" ,
817
+ repositoryUrl : `https://github.com/${ owner } /${ repo } .git` ,
818
+ } ;
819
+ const commits = [ ] ;
820
+ const nextRelease = { version : "1.1.0" } ;
821
+ const releases = [
822
+ { name : "GitHub release" , url : "https://github.com/release" } ,
823
+ ] ;
824
+
825
+ const fetch = fetchMock
826
+ . sandbox ( )
827
+ . getOnce ( `https://api.github.local/repos/${ owner } /${ repo } ` , {
828
+ full_name : `${ owner } /${ repo } ` ,
829
+ } )
830
+ . getOnce (
831
+ `https://api.github.local/search/issues?q=${ encodeURIComponent (
832
+ "in:title" ,
833
+ ) } +${ encodeURIComponent ( `repo:${ owner } /${ repo } ` ) } +${ encodeURIComponent (
834
+ "type:issue" ,
835
+ ) } +${ encodeURIComponent ( "state:open" ) } +${ encodeURIComponent ( failTitle ) } `,
836
+ { items : [ ] } ,
837
+ ) ;
838
+
839
+ await success (
840
+ pluginConfig ,
841
+ {
842
+ env,
843
+ options,
844
+ commits,
845
+ nextRelease,
846
+ releases,
847
+ logger : t . context . logger ,
848
+ } ,
849
+ {
850
+ Octokit : TestOctokit . defaults ( ( options ) => ( {
851
+ ...options ,
852
+ request : { ...options . request , fetch } ,
853
+ } ) ) ,
854
+ } ,
855
+ ) ;
856
+
857
+ t . true ( fetch . done ( ) ) ;
858
+ t . true ( t . context . log . calledWith ( "No commits found in release" ) ) ;
859
+ t . true (
860
+ t . context . log . calledWith ( "Skip commenting on issues and pull requests." ) ,
861
+ ) ;
862
+ } ) ;
863
+
809
864
test ( "Do not add comment and labels to PR/issues from other repo" , async ( t ) => {
810
865
const owner = "test_user" ;
811
866
const repo = "test_repo" ;
0 commit comments