locales-coverage.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: Build locales coverage
  2. on:
  3. push:
  4. branches:
  5. - l10n_master
  6. jobs:
  7. locales:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v2
  11. with:
  12. token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
  13. - name: Setup Node.js 14.x
  14. uses: actions/setup-node@v2
  15. with:
  16. node-version: 14.x
  17. - name: Create report file
  18. run: |
  19. yarn locales-coverage
  20. FILE_CHANGED=$(git diff src/locales/percentages.json)
  21. if [ ! -z "${FILE_CHANGED}" ]; then
  22. git config --global user.name 'Excalidraw Bot'
  23. git config --global user.email 'bot@excalidraw.com'
  24. git add src/locales/percentages.json
  25. git commit -am "Auto commit: Calculate translation coverage"
  26. git push
  27. fi
  28. - name: Construct comment body
  29. id: getCommentBody
  30. run: |
  31. body=$(npm run locales-coverage:description | grep '^[^>]')
  32. body="${body//'%'/'%25'}"
  33. body="${body//$'\n'/'%0A'}"
  34. body="${body//$'\r'/'%0D'}"
  35. echo ::set-output name=body::$body
  36. - name: Update description with coverage
  37. uses: kt3k/update-pr-description@v1.0.1
  38. with:
  39. pr_body: ${{ steps.getCommentBody.outputs.body }}
  40. pr_title: "chore: Update translations from Crowdin"
  41. github_token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}