translations-update.yml 1.7 KB

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