@@ -49,15 +49,37 @@ if (!crowdinApiKey) {
4949console . log ( "[DEBUG] Crowdin API key found ✓" )
5050const crowdinBearerHeaders = { Authorization : `Bearer ${ crowdinApiKey } ` }
5151
52+ // Parse environment variables with defaults
53+ const targetLanguages = process . env . TARGET_LANGUAGES
54+ ? process . env . TARGET_LANGUAGES . split ( "," ) . map ( ( lang ) => lang . trim ( ) )
55+ : [ "es-EM" ]
56+
57+ const baseBranch = process . env . BASE_BRANCH || "dev"
58+
59+ const fileLimit = process . env . FILE_LIMIT
60+ ? parseInt ( process . env . FILE_LIMIT , 10 )
61+ : 100
62+
63+ // Parse GitHub repository from env (format: "owner/repo")
64+ const githubRepo =
65+ process . env . GITHUB_REPOSITORY || "ethereum/ethereum-org-website"
66+ const [ ghOrganization , ghRepo ] = githubRepo . split ( "/" )
67+
68+ console . log ( "[DEBUG] Configuration:" )
69+ console . log ( `[DEBUG] - Target languages: ${ targetLanguages . join ( ", " ) } ` )
70+ console . log ( `[DEBUG] - Base branch: ${ baseBranch } ` )
71+ console . log ( `[DEBUG] - File limit: ${ fileLimit } ` )
72+ console . log ( `[DEBUG] - GitHub repo: ${ ghOrganization } /${ ghRepo } ` )
73+
5274const env = {
5375 projectId : 834930 ,
54- ghOrganization : "ethereum" ,
55- ghRepo : "ethereum-org-website" ,
76+ ghOrganization,
77+ ghRepo,
5678 jsonRoot : "src/intl/en" ,
5779 mdRoot : "public/content" ,
5880 preTranslatePromptId : 168584 ,
59- allCrowdinCodes : [ "es-EM" ] , // i18nConfig.map((item) => item.crowdinCode) ,
60- baseBranch : "i18n-flow-1" , // "dev" ,
81+ allCrowdinCodes : targetLanguages ,
82+ baseBranch,
6183}
6284
6385// --- Utilities: resilient fetch for GitHub calls ---
@@ -1067,8 +1089,8 @@ async function main(options?: { allLangs: boolean }) {
10671089 allCrowdinCodes : env . allCrowdinCodes ,
10681090 } )
10691091
1070- // Increase scope of English files fetched (remove overly restrictive perPage=4)
1071- const allEnglishFiles = await getAllEnglishFiles ( )
1092+ // Fetch English files with the configured file limit
1093+ const allEnglishFiles = await getAllEnglishFiles ( fileLimit )
10721094 console . log (
10731095 `[DEBUG] Found ${ allEnglishFiles . length } English files from GitHub`
10741096 )
0 commit comments