From b59c9d8431a4fda2aea02b53e0a88d74fc3a173d Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Fri, 7 Jun 2024 08:21:55 +0200 Subject: [PATCH] Refresh Weblate with latest changes when the main branch changes (#30053) --- .github/workflows/weblate.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/weblate.yml diff --git a/.github/workflows/weblate.yml b/.github/workflows/weblate.yml new file mode 100644 index 0000000000..98c5de4c3f --- /dev/null +++ b/.github/workflows/weblate.yml @@ -0,0 +1,35 @@ +name: Weblate Sync + +on: + # Update Weblate once a day, and if a translation file (source or target) changes. + # Using this workflow prevents Weblate to rebase its PRs on every commit in Keycloak's main branch. + schedule: + - cron: '0 0 * * *' + workflow_dispatch: {} + push: + branches: + - main + paths: + - 'themes/**/messages_*.properties' + - 'js/**/messages_*.properties' + +defaults: + run: + shell: bash + +concurrency: + # Only cancel jobs for PR updates + group: weblate-${{ github.ref }} + cancel-in-progress: true + +jobs: + update-weblate: + name: Trigger Weblate to pull the latest changes + runs-on: ubuntu-latest + + steps: + # language=bash + - run: | + if [ '${{ secrets.WEBLATE_TOKEN }}' != '' ]; then + curl --fail-with-body -d operation=pull -H "Authorization: Token ${{ secrets.WEBLATE_TOKEN }}" https://hosted.weblate.org/api/projects/keycloak/repository/ + fi