Skip to content

Commit

Permalink
debug: check for paths before staging
Browse files Browse the repository at this point in the history
  • Loading branch information
wackerow committed Oct 9, 2024
1 parent 3a09e7e commit 517bf11
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/scripts/crowdin/translations/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,22 @@ export const createLocaleTranslationPR = (
}).trim()
execSync(`git checkout -b ${branchName}`)
execSync("git reset .")
execSync(`git add ${TRANSLATIONS_DIR}/${locale}`)
execSync(`git add ${INTL_JSON_DIR}/${locale}`)

// Check if the translations directory exists and contains files
const translationsDir = path.join(TRANSLATIONS_DIR, locale)
if (
fs.existsSync(translationsDir) &&
fs.readdirSync(translationsDir).length > 0
) {
execSync(`git add ${translationsDir}`)
}

// Check if the intl JSON directory exists and contains files
const intlJsonDir = path.join(INTL_JSON_DIR, locale)
if (fs.existsSync(intlJsonDir) && fs.readdirSync(intlJsonDir).length > 0) {
execSync(`git add ${intlJsonDir}`)
}

execSync(`git commit -m "${message}"`)
execSync(`git push origin ${branchName}`)

Expand Down

0 comments on commit 517bf11

Please sign in to comment.