@@ -163,6 +163,53 @@ describe('versionDispatch', () => {
163163 } )
164164 } )
165165
166+ it ( 'skips private packages when computing the dispatch payload' , async ( ) => {
167+ fs = createFsFromJSON ( {
168+ 'lerna.json' : lernaConfig ,
169+ 'libraries/atoms/package.json' : JSON . stringify ( { name : '@exodus/atoms' , private : true } ) ,
170+ 'libraries/wallet/package.json' : JSON . stringify ( { name : '@exodus/wallet' } ) ,
171+ 'modules/blockchain-metadata/package.json' : JSON . stringify ( {
172+ name : '@exodus/blockchain-metadata' ,
173+ } ) ,
174+ 'modules/balances/package.json' : JSON . stringify ( { name : '@exodus/balances' } ) ,
175+ } )
176+
177+ github . context . payload = {
178+ pull_request : {
179+ title : 'feat: cool stuff' ,
180+ number : 123 ,
181+ merged : true ,
182+ user : { login : 'brucewayne' } ,
183+ base : { ref } ,
184+ labels : [ ] ,
185+ } ,
186+ }
187+
188+ setupPaginate (
189+ [
190+ { sha : 'aaa1111' , commit : { message : 'feat(atoms)!: drop legacy' } } ,
191+ { sha : 'bbb2222' , commit : { message : 'fix(balances): tidy' } } ,
192+ ] ,
193+ {
194+ aaa1111 : [ { filename : 'libraries/atoms/index.ts' } ] ,
195+ bbb2222 : [ { filename : 'modules/balances/x.ts' } ] ,
196+ }
197+ )
198+
199+ await versionDispatch ( { filesystem : fs as never } )
200+
201+ expect ( client . rest . actions . createWorkflowDispatch ) . toHaveBeenCalledWith ( {
202+ ...repo ,
203+ ref,
204+ workflow_id : workflowId ,
205+ inputs : {
206+ assignee : 'brucewayne' ,
207+ packages : '@exodus/balances' ,
208+ bumps : JSON . stringify ( { '@exodus/balances' : 'patch' } ) ,
209+ } ,
210+ } )
211+ } )
212+
166213 it ( 'falls back to the PR title when no commit carries a bump' , async ( ) => {
167214 github . context . payload = {
168215 pull_request : {
@@ -412,6 +459,108 @@ describe('versionDispatch', () => {
412459 expect ( client . rest . issues . createComment ) . not . toHaveBeenCalled ( )
413460 } )
414461
462+ it ( 'omits private packages from the preview comment' , async ( ) => {
463+ fs = createFsFromJSON ( {
464+ 'lerna.json' : lernaConfigWithVersions ,
465+ 'libraries/atoms/package.json' : JSON . stringify ( {
466+ name : '@exodus/atoms' ,
467+ version : '1.0.0' ,
468+ private : true ,
469+ } ) ,
470+ 'libraries/wallet/package.json' : JSON . stringify ( {
471+ name : '@exodus/wallet' ,
472+ version : '3.4.5' ,
473+ } ) ,
474+ 'modules/blockchain-metadata/package.json' : JSON . stringify ( {
475+ name : '@exodus/blockchain-metadata' ,
476+ version : '0.1.0' ,
477+ } ) ,
478+ 'modules/balances/package.json' : JSON . stringify ( {
479+ name : '@exodus/balances' ,
480+ version : '2.7.9' ,
481+ } ) ,
482+ } )
483+
484+ github . context . payload = {
485+ pull_request : {
486+ title : 'feat: pending' ,
487+ number : 555 ,
488+ merged : false ,
489+ state : 'open' ,
490+ user : { login : 'brucewayne' } ,
491+ base : { ref } ,
492+ labels : [ ] ,
493+ } ,
494+ }
495+
496+ setupPreviewPaginate (
497+ [
498+ { sha : 'aaa1111' , commit : { message : 'feat(atoms)!: drop legacy' } } ,
499+ { sha : 'bbb2222' , commit : { message : 'fix(balances): tidy' } } ,
500+ ] ,
501+ {
502+ aaa1111 : [ { filename : 'libraries/atoms/index.ts' } ] ,
503+ bbb2222 : [ { filename : 'modules/balances/x.ts' } ] ,
504+ }
505+ )
506+
507+ await versionDispatch ( { filesystem : fs as never } )
508+
509+ expect ( client . rest . issues . createComment ) . toHaveBeenCalledTimes ( 1 )
510+ const [ args ] = ( client . rest . issues . createComment as unknown as jest . Mock ) . mock . calls [ 0 ]
511+ expect ( args . body ) . toContain ( '@exodus/balances' )
512+ expect ( args . body ) . not . toContain ( '@exodus/atoms' )
513+ } )
514+
515+ it ( 'clears stale preview comments when every touched package is private' , async ( ) => {
516+ fs = createFsFromJSON ( {
517+ 'lerna.json' : lernaConfigWithVersions ,
518+ 'libraries/atoms/package.json' : JSON . stringify ( {
519+ name : '@exodus/atoms' ,
520+ version : '1.0.0' ,
521+ private : true ,
522+ } ) ,
523+ 'libraries/wallet/package.json' : JSON . stringify ( {
524+ name : '@exodus/wallet' ,
525+ version : '3.4.5' ,
526+ } ) ,
527+ 'modules/blockchain-metadata/package.json' : JSON . stringify ( {
528+ name : '@exodus/blockchain-metadata' ,
529+ version : '0.1.0' ,
530+ } ) ,
531+ 'modules/balances/package.json' : JSON . stringify ( {
532+ name : '@exodus/balances' ,
533+ version : '2.7.9' ,
534+ } ) ,
535+ } )
536+
537+ github . context . payload = {
538+ pull_request : {
539+ title : 'feat: pending' ,
540+ number : 555 ,
541+ merged : false ,
542+ state : 'open' ,
543+ user : { login : 'brucewayne' } ,
544+ base : { ref } ,
545+ labels : [ ] ,
546+ } ,
547+ }
548+
549+ setupPreviewPaginate (
550+ [ { sha : 'aaa1111' , commit : { message : 'feat(atoms)!: drop legacy' } } ] ,
551+ { aaa1111 : [ { filename : 'libraries/atoms/index.ts' } ] } ,
552+ [ { id : 9200 , body : `${ PREVIEW_MARKER } \nstale preview from before private flag was set` } ]
553+ )
554+
555+ await versionDispatch ( { filesystem : fs as never } )
556+
557+ expect ( client . rest . issues . deleteComment ) . toHaveBeenCalledWith ( {
558+ ...repo ,
559+ comment_id : 9200 ,
560+ } )
561+ expect ( client . rest . issues . createComment ) . not . toHaveBeenCalled ( )
562+ } )
563+
415564 it ( 'clears stale comments and posts nothing when no commits bump anything' , async ( ) => {
416565 github . context . payload = {
417566 pull_request : {
0 commit comments