@@ -321,61 +321,48 @@ ${this.results.reduce((x, y) => {
321321 }
322322 }
323323
324- // Overlay repo config
324+ // Overlay repo config
325325 // RepoConfigs should be preloaded but checking anyway
326326 const overrideRepoConfig = this . repoConfigs [ `${ repo . repo } .yml` ] ?. repository || this . repoConfigs [ `${ repo . repo } .yaml` ] ?. repository
327327 if ( overrideRepoConfig ) {
328328 repoConfig = this . mergeDeep . mergeDeep ( { } , repoConfig , overrideRepoConfig )
329329 }
330- if ( repoConfig ) {
331- try {
332- this . log . debug ( `found a matching repoconfig for this repo ${ JSON . stringify ( repoConfig ) } ` )
333-
334- const childPlugins = this . childPluginsList ( repo )
335- const RepoPlugin = Settings . PLUGINS . repository
336-
337- const archivePlugin = new Archive ( this . nop , this . github , repo , repoConfig , this . log )
338- const { shouldArchive, shouldUnarchive } = await archivePlugin . getState ( )
339-
340- if ( shouldUnarchive ) {
341- this . log . debug ( `Unarchiving repo ${ repo . repo } ` )
342- const unArchiveResults = await archivePlugin . sync ( )
343- this . appendToResults ( unArchiveResults )
344- }
345-
346- const repoResults = await new RepoPlugin ( this . nop , this . github , repo , repoConfig , this . installation_id , this . log , this . errors ) . sync ( )
347- this . appendToResults ( repoResults )
348-
349- const childResults = await Promise . all (
350- childPlugins . map ( ( [ Plugin , config ] ) => {
351- return new Plugin ( this . nop , this . github , repo , config , this . log , this . errors ) . sync ( )
330+ const { shouldContinue, nopCommands} = await new Archive ( this . nop , this . github , repo , repoConfig , this . log ) . sync ( )
331+ if ( nopCommands ) this . appendToResults ( nopCommands )
332+ if ( shouldContinue ) {
333+ if ( repoConfig ) {
334+ try {
335+ this . log . debug ( `found a matching repoconfig for this repo ${ JSON . stringify ( repoConfig ) } ` )
336+ const childPlugins = this . childPluginsList ( repo )
337+ const RepoPlugin = Settings . PLUGINS . repository
338+ return new RepoPlugin ( this . nop , this . github , repo , repoConfig , this . installation_id , this . log , this . errors ) . sync ( ) . then ( res => {
339+ this . appendToResults ( res )
340+ return Promise . all (
341+ childPlugins . map ( ( [ Plugin , config ] ) => {
342+ return new Plugin ( this . nop , this . github , repo , config , this . log , this . errors ) . sync ( )
343+ } ) )
344+ } ) . then ( res => {
345+ this . appendToResults ( res )
352346 } )
353- )
354- this . appendToResults ( childResults )
355-
356- if ( shouldArchive ) {
357- this . log . debug ( `Archiving repo ${ repo . repo } ` )
358- const archiveResults = await archivePlugin . sync ( )
359- this . appendToResults ( archiveResults )
360- }
361- } catch ( e ) {
362- if ( this . nop ) {
363- const nopcommand = new NopCommand ( this . constructor . name , this . repo , null , `${ e } ` , 'ERROR' )
364- this . log . error ( `NOPCOMMAND ${ JSON . stringify ( nopcommand ) } ` )
365- this . appendToResults ( [ nopcommand ] )
366- // throw e
367- } else {
368- throw e
347+ } catch ( e ) {
348+ if ( this . nop ) {
349+ const nopcommand = new NopCommand ( this . constructor . name , this . repo , null , `${ e } ` , 'ERROR' )
350+ this . log . error ( `NOPCOMMAND ${ JSON . stringify ( nopcommand ) } ` )
351+ this . appendToResults ( [ nopcommand ] )
352+ // throw e
353+ } else {
354+ throw e
355+ }
369356 }
357+ } else {
358+ this . log . debug ( `Didnt find any a matching repoconfig for this repo ${ JSON . stringify ( repo ) } in ${ JSON . stringify ( this . repoConfigs ) } ` )
359+ const childPlugins = this . childPluginsList ( repo )
360+ return Promise . all ( childPlugins . map ( ( [ Plugin , config ] ) => {
361+ return new Plugin ( this . nop , this . github , repo , config , this . log , this . errors ) . sync ( ) . then ( res => {
362+ this . appendToResults ( res )
363+ } )
364+ } ) )
370365 }
371- } else {
372- this . log . debug ( `Didnt find any a matching repoconfig for this repo ${ JSON . stringify ( repo ) } in ${ JSON . stringify ( this . repoConfigs ) } ` )
373- const childPlugins = this . childPluginsList ( repo )
374- return Promise . all ( childPlugins . map ( ( [ Plugin , config ] ) => {
375- return new Plugin ( this . nop , this . github , repo , config , this . log , this . errors ) . sync ( ) . then ( res => {
376- this . appendToResults ( res )
377- } )
378- } ) )
379366 }
380367 }
381368
@@ -906,6 +893,7 @@ ${this.results.reduce((x, y) => {
906893 throw new Error ( `Failed to filter repositories for property ${ name } : ${ error . message } ` )
907894 }
908895 }
896+
909897
910898 async getSubOrgRepositories ( subOrgProperties ) {
911899 const organizationName = this . repo . owner
0 commit comments