translate-i18n-base-on-english.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: Check i18n Files and Create PR
  2. on:
  3. pull_request:
  4. types: [closed]
  5. branches: [main]
  6. jobs:
  7. check-and-update:
  8. if: github.event.pull_request.merged == true
  9. runs-on: ubuntu-latest
  10. defaults:
  11. run:
  12. working-directory: web
  13. steps:
  14. - uses: actions/checkout@v4
  15. with:
  16. fetch-depth: 0
  17. - name: Check for file changes in i18n/en-US
  18. id: check_files
  19. run: |
  20. changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- 'i18n/en-US/*.ts')
  21. echo "Changed files: $changed_files"
  22. if [ -n "$changed_files" ]; then
  23. echo "FILES_CHANGED=true" >> $GITHUB_ENV
  24. else
  25. echo "FILES_CHANGED=false" >> $GITHUB_ENV
  26. fi
  27. - name: Set up Node.js
  28. if: env.FILES_CHANGED == 'true'
  29. uses: actions/setup-node@v2
  30. with:
  31. node-version: 'lts/*'
  32. - name: Install dependencies
  33. if: env.FILES_CHANGED == 'true'
  34. run: yarn install --frozen-lockfile
  35. - name: Run npm script
  36. if: env.FILES_CHANGED == 'true'
  37. run: npm run auto-gen-i18n
  38. - name: Create Pull Request
  39. if: env.FILES_CHANGED == 'true'
  40. uses: peter-evans/create-pull-request@v6
  41. with:
  42. commit-message: Update i18n files based on en-US changes
  43. title: 'chore: translate i18n files'
  44. body: This PR was automatically created to update i18n files based on changes in en-US locale.
  45. branch: chore/automated-i18n-updates