Smartling translations are completed for commit d7336d9b2851df7b1cec8480d432dbd0e157e269 from main #1551
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Fix translations | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
i18n-fixes: | |
name: Fix translated files | |
runs-on: ubuntu-latest | |
if: startsWith(github.head_ref, 'smartling') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.ADJUST_NPM_TOKEN }} | |
steps: | |
- name: Checkout the PR branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: https://npm.pkg.github.com/ | |
scope: "@adjust" | |
- name: Install dependencies | |
run: npm install | |
- name: Get modified files in the PR | |
id: files | |
run: | | |
git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} | |
modified_files=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...${{ github.event.pull_request.head.ref }}) | |
{ | |
echo 'modified_files<<EOF' | |
echo $modified_files | |
echo EOF | |
}>> $GITHUB_OUTPUT | |
- name: Run translation fixes script | |
run: | | |
modified_files="${{ steps.files.outputs.modified_files }}" | |
modified_files=$(echo "$modified_files" | grep -E '\.mdx$|\.mdoc$') | |
if [ -n "$modified_files" ]; then | |
echo "Files to process: $modified_files" | |
node .github/scripts/fixTranslations.mjs $modified_files | |
else | |
echo "No MDX or MDOC files modified. Skipping translation fixes." | |
fi | |
- name: Check for modified files after script | |
id: git-check | |
run: | | |
MODIFIED=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi) | |
echo "MODIFIED=$MODIFIED" >> $GITHUB_ENV | |
echo "MODIFIED=$MODIFIED" >> $GITHUB_OUTPUT | |
- name: Commit changes | |
if: ${{ steps.git-check.outputs.MODIFIED == 'true' }} | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git commit -am "Fix translated and formatted files" | |
git push origin ${{ github.head_ref }} |