diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 953b6a4..ef58044 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -127,7 +127,7 @@ Crowdin push: - .yarnCache script: - yarn i18n:extract - - yes | yarn i18n:push + - yarn i18n:push artifacts: name: "Source strings for $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA" paths: diff --git a/packages/scripts/i18n-crowdin.ts b/packages/scripts/i18n-crowdin.ts index d51f0b5..e0df0a4 100644 --- a/packages/scripts/i18n-crowdin.ts +++ b/packages/scripts/i18n-crowdin.ts @@ -277,7 +277,18 @@ async function push(): Promise { }); } - const { disapproveTranslates, publishInBranch = false } = await prompt(questions); + let disapproveTranslates = true; + let publishInBranch = false; + try { + const answers = await prompt(questions); + disapproveTranslates = answers[0]; + publishInBranch = answers[1] || false; + } catch (err) { + // okay if it's tty error + if (!err.isTtyError) { + throw err; + } + } let branchId: number|undefined; if (publishInBranch) { @@ -336,19 +347,21 @@ async function push(): Promise { console.log(ch.green('Success')); } -try { - const action = process.argv[2]; +(async() => { + try { + const action = process.argv[2]; - switch (action) { - case 'pull': - pull(); - break; - case 'push': - push(); - break; - default: - console.error(`Unknown action ${action}`); + switch (action) { + case 'pull': + await pull(); + break; + case 'push': + await push(); + break; + default: + console.error(`Unknown action ${action}`); + } + } catch (exception) { + console.error(exception); } -} catch (exception) { - console.error(exception); -} +})();