translations-update.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: "Update translations"
  2. on: # yamllint disable-line rule:truthy
  3. schedule:
  4. - cron: "05 07 * * 5"
  5. workflow_dispatch:
  6. jobs:
  7. babel:
  8. name: "create PR for additions from weblate"
  9. runs-on: ubuntu-24.04
  10. if: ${{ github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' }}
  11. steps:
  12. - name: Checkout
  13. uses: actions/checkout@v4
  14. with:
  15. fetch-depth: '0'
  16. token: ${{ secrets.WEBLATE_GITHUB_TOKEN }}
  17. - name: Set up Python
  18. uses: actions/setup-python@v5
  19. with:
  20. python-version: '3.12'
  21. architecture: 'x64'
  22. - name: Cache Python dependencies
  23. id: cache-python
  24. uses: actions/cache@v4
  25. with:
  26. path: |
  27. ./local
  28. ./.nvm
  29. ./node_modules
  30. key: python-ubuntu-24.04-3.12-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
  31. - name: weblate & git setup
  32. env:
  33. WEBLATE_CONFIG: ${{ secrets.WEBLATE_CONFIG }}
  34. run: |
  35. mkdir -p ~/.config
  36. echo "${WEBLATE_CONFIG}" > ~/.config/weblate
  37. git config --global user.email "searxng-bot@users.noreply.github.com"
  38. git config --global user.name "searxng-bot"
  39. - name: Merge and push transation updates
  40. run: |
  41. make V=1 weblate.translations.commit
  42. - name: Create Pull Request
  43. id: cpr
  44. uses: peter-evans/create-pull-request@v3
  45. with:
  46. token: ${{ secrets.WEBLATE_GITHUB_TOKEN }}
  47. commit-message: '[l10n] update translations from Weblate'
  48. committer: searxng-bot <searxng-bot@users.noreply.github.com>
  49. author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
  50. signoff: false
  51. branch: translations_update
  52. delete-branch: true
  53. draft: false
  54. title: '[l10n] update translations from Weblate'
  55. body: |
  56. update translations from Weblate
  57. labels: |
  58. translation