Skip to content

Commit 517bf11

Browse files
committed
debug: check for paths before staging
1 parent 3a09e7e commit 517bf11

File tree

1 file changed

+16
-2
lines changed
  • src/scripts/crowdin/translations

1 file changed

+16
-2
lines changed

src/scripts/crowdin/translations/utils.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,22 @@ export const createLocaleTranslationPR = (
5858
}).trim()
5959
execSync(`git checkout -b ${branchName}`)
6060
execSync("git reset .")
61-
execSync(`git add ${TRANSLATIONS_DIR}/${locale}`)
62-
execSync(`git add ${INTL_JSON_DIR}/${locale}`)
61+
62+
// Check if the translations directory exists and contains files
63+
const translationsDir = path.join(TRANSLATIONS_DIR, locale)
64+
if (
65+
fs.existsSync(translationsDir) &&
66+
fs.readdirSync(translationsDir).length > 0
67+
) {
68+
execSync(`git add ${translationsDir}`)
69+
}
70+
71+
// Check if the intl JSON directory exists and contains files
72+
const intlJsonDir = path.join(INTL_JSON_DIR, locale)
73+
if (fs.existsSync(intlJsonDir) && fs.readdirSync(intlJsonDir).length > 0) {
74+
execSync(`git add ${intlJsonDir}`)
75+
}
76+
6377
execSync(`git commit -m "${message}"`)
6478
execSync(`git push origin ${branchName}`)
6579

0 commit comments

Comments
 (0)