This guide explains how to use our build validation script with Vercel's "Ignored Build Step" feature to ensure proper localization file updates.
When deploying to Vercel, it's important to ensure that all localization files are properly synchronized. We provide a build script that validates localization file changes and determines whether a deployment should proceed.
In your Vercel project settings, you can use our validation script in the "Ignored Build Step" field. This will prevent unnecessary builds when localization files aren't properly synchronized.
Set the following in the "Ignored Build Step" field:
bash vercel-build.sh
Note: Make sure the script is in your repository's root directory or adjust the path accordingly.
The build script (vercel-build.sh
) checks if changes to the source localization file (en.json
) are properly reflected in other locale files:
#!/bin/bash # Change these to your source paths LOCALES_DIR="src/locales" SOURCE_FILE="${LOCALES_DIR}/en.json" # Check if there are any changes at all if git diff HEAD^ HEAD --quiet; then echo "No changes detected. Skipping build." exit 0 fi # Check if there are changes in source file if git diff --name-only HEAD^ HEAD | grep -q "^${SOURCE_FILE}$"; then echo "Changes detected in ${SOURCE_FILE}" # Check if other files in source directory were also changed if git diff --name-only HEAD^ HEAD | grep -q "^${LOCALES_DIR}/[^/]*\.json$" | grep -v "^${SOURCE_FILE}$"; then echo "Other locale files were also changed. Proceeding with build..." exit 1 else echo "${SOURCE_FILE} was changed but other locale files were not. Failing build." exit 0 fi else # If no changes in source file, proceed with build echo "No changes in ${SOURCE_FILE}. Proceeding with build..." exit 1 fi
The script follows Vercel's "Ignored Build Step" convention:
exit 0
: Skip the build (when validation fails or no changes detected)exit 1
: Proceed with the build (when changes are valid)The script performs these checks:
en.json
) was modified:
git clone --depth=10
, so the script will only have access to the last 10 commitschmod +x vercel-build.sh
) before committingFor more information about setting up GitHub Actions for translation workflows, see our GitHub Actions guide.