@@ -14,12 +14,33 @@ async function getOnboardingConfig(
1414) : Promise < RenovateSharedConfig | undefined > {
1515 let onboardingConfig = clone ( config . onboardingConfig ) ;
1616
17- let foundPreset : string | undefined ;
17+ // TODO #22198 fix types
18+ const foundPreset = await searchDefaultOnboardingPreset ( config . repository ! ) ;
19+
20+ if ( foundPreset ) {
21+ logger . debug ( `Found preset ${ foundPreset } - using it in onboarding config` ) ;
22+ onboardingConfig = {
23+ $schema : 'https://docs.renovatebot.com/renovate-schema.json' ,
24+ extends : [ foundPreset ] ,
25+ } ;
26+ } else {
27+ // Organization preset did not exist
28+ logger . debug (
29+ 'No default org/owner preset found, so the default onboarding config will be used instead.' ,
30+ ) ;
31+ }
32+
33+ logger . debug ( { config : onboardingConfig } , 'onboarding config' ) ;
34+ return onboardingConfig ;
35+ }
1836
37+ async function searchDefaultOnboardingPreset (
38+ repository : string ,
39+ ) : Promise < string | undefined > {
40+ let foundPreset : string | undefined ;
1941 logger . debug ( 'Checking for a default Renovate preset which can be used.' ) ;
2042
21- // TODO #22198
22- const repoPathParts = config . repository ! . split ( '/' ) ;
43+ const repoPathParts = repository . split ( '/' ) ;
2344
2445 for (
2546 let index = repoPathParts . length - 1 ;
@@ -77,21 +98,7 @@ async function getOnboardingConfig(
7798 }
7899 }
79100
80- if ( foundPreset ) {
81- logger . debug ( `Found preset ${ foundPreset } - using it in onboarding config` ) ;
82- onboardingConfig = {
83- $schema : 'https://docs.renovatebot.com/renovate-schema.json' ,
84- extends : [ foundPreset ] ,
85- } ;
86- } else {
87- // Organization preset did not exist
88- logger . debug (
89- 'No default org/owner preset found, so the default onboarding config will be used instead.' ,
90- ) ;
91- }
92-
93- logger . debug ( { config : onboardingConfig } , 'onboarding config' ) ;
94- return onboardingConfig ;
101+ return foundPreset ;
95102}
96103
97104async function getOnboardingConfigContents (
0 commit comments