You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: 2 # last 2 commits
  17. persist-credentials: false
  18. - name: Check for file changes in i18n/en-US
  19. id: check_files
  20. run: |
  21. recent_commit_sha=$(git rev-parse HEAD)
  22. second_recent_commit_sha=$(git rev-parse HEAD~1)
  23. changed_files=$(git diff --name-only $recent_commit_sha $second_recent_commit_sha -- 'i18n/en-US/*.ts')
  24. echo "Changed files: $changed_files"
  25. if [ -n "$changed_files" ]; then
  26. echo "FILES_CHANGED=true" >> $GITHUB_ENV
  27. else
  28. echo "FILES_CHANGED=false" >> $GITHUB_ENV
  29. fi
  30. - name: Install pnpm
  31. uses: pnpm/action-setup@v4
  32. with:
  33. version: 10
  34. run_install: false
  35. - name: Set up Node.js
  36. if: env.FILES_CHANGED == 'true'
  37. uses: actions/setup-node@v4
  38. with:
  39. node-version: 'lts/*'
  40. cache: pnpm
  41. cache-dependency-path: ./web/package.json
  42. - name: Install dependencies
  43. if: env.FILES_CHANGED == 'true'
  44. run: pnpm install --frozen-lockfile
  45. - name: Run npm script
  46. if: env.FILES_CHANGED == 'true'
  47. run: pnpm run auto-gen-i18n
  48. - name: Create Pull Request
  49. if: env.FILES_CHANGED == 'true'
  50. uses: peter-evans/create-pull-request@v6
  51. with:
  52. commit-message: Update i18n files based on en-US changes
  53. title: 'chore: translate i18n files'
  54. body: This PR was automatically created to update i18n files based on changes in en-US locale.
  55. branch: chore/automated-i18n-updates