@@ -183,47 +183,21 @@ export default class ContentModelSeeder {
183183 async shouldProceed ( api_key : string ) {
184184 let count ;
185185 const stack_details = await this . csClient . getStack ( api_key ) ;
186- if ( this . options . master_locale != stack_details . master_locale ) {
187- cliux . print ( `Compass app requires the master locale to be set to English (en).` , {
188- color : "yellow" ,
189- bold : true ,
190- } ) ;
191- return false ;
192- }
193- const managementBody = {
194- "name" :"Checking roles for creating management token" ,
195- "description" :"This is a compass app management token." ,
196- "scope" :[
197- {
198- "module" :"content_type" ,
199- "acl" :{
200- "read" :true ,
201- "write" :true
202- }
203- } ,
204- {
205- "module" :"branch" ,
206- "branches" :[
207- "main"
208- ] ,
209- "acl" :{
210- "read" :true
211- }
212- }
213- ] ,
214- "expires_on" : "3000-01-01" ,
215- "is_email_notification_enabled" :false
216- }
217- let managementTokenResult = await this . csClient . createManagementToken ( api_key , this . managementToken , managementBody ) ;
218- if ( managementTokenResult ?. response_code == "161" || managementTokenResult ?. response_code == "401" ) {
186+
187+ const repoMasterLocale = await this . ghClient . getMasterLocaleFromRepo ( this . ghRepo as string ) ;
188+ const expectedLocale = repoMasterLocale || this . options . master_locale || ENGLISH_LOCALE ;
189+
190+ if ( stack_details . master_locale !== expectedLocale ) {
219191 cliux . print (
220- `Info: Failed to generate a management token.\nNote: Management token is not available in your plan. Please contact the admin for support .` ,
192+ `Repository ' ${ this . ghRepo } ' requires the master locale to be set to ' ${ expectedLocale } ', but your stack has ' ${ stack_details . master_locale } ' .` ,
221193 {
222- color : 'red' ,
223- } ,
194+ color : "yellow" ,
195+ bold : true ,
196+ }
224197 ) ;
225198 return false ;
226- }
199+ }
200+
227201 count = await this . csClient . getContentTypeCount ( api_key , this . managementToken ) ;
228202
229203 if ( count > 0 && this . _options . skipStackConfirmation !== 'yes' ) {
0 commit comments