From d90c9c4b77bc02ab169d231d7b3614b9316d5ccb Mon Sep 17 00:00:00 2001 From: Ruben Talstra Date: Mon, 10 Feb 2025 15:03:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9C=20ci:=20Consolidate=20Locize=20Wor?= =?UTF-8?q?kflows=20for=20Missing=20Keys=20&=20PR=20Creation=20(#5769)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ished-sync-pr.yml => locize-i18n-sync.yml} | 41 +++++++++++++++---- .../workflows/locize-push-missing-keys.yml | 26 ------------ 2 files changed, 32 insertions(+), 35 deletions(-) rename .github/workflows/{locize-pull-published-sync-pr.yml => locize-i18n-sync.yml} (57%) delete mode 100644 .github/workflows/locize-push-missing-keys.yml diff --git a/.github/workflows/locize-pull-published-sync-pr.yml b/.github/workflows/locize-i18n-sync.yml similarity index 57% rename from .github/workflows/locize-pull-published-sync-pr.yml rename to .github/workflows/locize-i18n-sync.yml index 17c893ab2..e6d71e2e6 100644 --- a/.github/workflows/locize-pull-published-sync-pr.yml +++ b/.github/workflows/locize-i18n-sync.yml @@ -1,23 +1,47 @@ -name: Create Translation PR on Version Published +name: Push New Keys & Create Translation PR on: -# do not run during PR request only on push and repository_dispatch -# pull_request: -# branches: -# - main push: branches: [main] repository_dispatch: types: [locize/versionPublished] jobs: - createPullRequest: + push-new-keys: + name: Push Missing Translation Keys to locize + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install locize CLI + run: npm install -g locize-cli + + # Only push keys if this workflow was triggered by a push event. + - name: Push Missing Translation Keys to locize + if: ${{ github.event_name == 'push' }} + run: | + cd client/src/locales + locize save-missing --api-key ${{ secrets.LOCIZE_API_KEY }} --project-id ${{ secrets.LOCIZE_PROJECT_ID }} --language en + + # When triggered by repository_dispatch, skip pushing new keys. + - name: Skip push step on non-push events + if: ${{ github.event_name != 'push' }} + run: echo "Skipping push of new keys as the event is not a push." + + create-pull-request: name: Create Translation PR on Version Published runs-on: ubuntu-latest + # This job will wait for push-new-keys to complete. + needs: push-new-keys permissions: contents: write pull-requests: write - steps: # 1. Check out the repository. - name: Checkout Repository @@ -46,5 +70,4 @@ jobs: - 🎯 **Objective**: Update `translation.json` with the latest translations from locize. - 🔍 **Details**: This PR is automatically generated upon receiving a versionPublished event with version "latest". It reflects the newest translations provided by locize. - ✅ **Status**: Ready for review. - labels: | - 🌍 i18n \ No newline at end of file + labels: "🌍 i18n" \ No newline at end of file diff --git a/.github/workflows/locize-push-missing-keys.yml b/.github/workflows/locize-push-missing-keys.yml deleted file mode 100644 index 1244d0c0b..000000000 --- a/.github/workflows/locize-push-missing-keys.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Push New Keys to locize - -on: - push: - branches: [main] - -jobs: - push-new-keys: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set Up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install locize CLI - run: npm install -g locize-cli - - - name: Push Missing Translation Keys to locize - run: | - cd client/src/locales - locize save-missing --api-key ${{ secrets.LOCIZE_API_KEY }} --project-id ${{ secrets.LOCIZE_PROJECT_ID }} --language en \ No newline at end of file