From ba51c091f026a16fd3a98d3b967367d80a024ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Fri, 21 Feb 2025 15:42:01 +0100 Subject: [PATCH] Improve i18n CI (#10390) --- .github/workflows/i18n-pull.yaml | 21 ++++++++------------- .github/workflows/i18n-push.yaml | 3 ++- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/i18n-pull.yaml b/.github/workflows/i18n-pull.yaml index 562f9feec..5e3704b01 100644 --- a/.github/workflows/i18n-pull.yaml +++ b/.github/workflows/i18n-pull.yaml @@ -1,7 +1,7 @@ # Pull down translations from Crowdin every two hours or when triggered manually. # When force_pull input is true, translations will be pulled regardless of compilation status. -name: 'Pull translations' +name: 'Pull translations from Crowdin' on: schedule: @@ -53,7 +53,7 @@ jobs: # Strict mode fails if there are missing translations. - name: Compile translations - id: compile_translations + id: compile_translations_strict run: | npx nx run twenty-server:lingui:compile --strict npx nx run twenty-emails:lingui:compile --strict @@ -68,7 +68,7 @@ jobs: git stash - name: Pull translations from Crowdin - if: inputs.force_pull || steps.compile_translations.outcome == 'failure' + if: inputs.force_pull || steps.compile_translations_strict.outcome == 'failure' uses: crowdin/github-action@v2 with: upload_sources: false @@ -98,18 +98,13 @@ jobs: run: sudo chown -R runner:docker . - name: Compile translations - if: inputs.force_pull || steps.compile_translations.outcome == 'failure' + id: compile_translations + if: inputs.force_pull || steps.compile_translations_strict.outcome == 'failure' run: | npx nx run twenty-server:lingui:compile npx nx run twenty-emails:lingui:compile npx nx run twenty-front:lingui:compile - - - name: Debug git status - run: git status - - - name: Check and commit compiled files - id: check_changes - run: | + git status git config --global user.name 'github-actions' git config --global user.email 'github-actions@twenty.com' git add . @@ -121,11 +116,11 @@ jobs: fi - name: Push changes - if: steps.check_changes.outputs.changes_detected == 'true' + if: steps.compile_translations.outputs.changes_detected == 'true' run: git push origin HEAD:i18n - name: Create pull request - if: steps.check_changes.outputs.changes_detected == 'true' + if: steps.compile_translations.outputs.changes_detected == 'true' run: | if git diff --name-only origin/main..HEAD | grep -q .; then gh pr create -B main -H i18n --title 'i18n - translations' --body 'Created by Github action' || true diff --git a/.github/workflows/i18n-push.yaml b/.github/workflows/i18n-push.yaml index d21e823cc..958d8292c 100644 --- a/.github/workflows/i18n-push.yaml +++ b/.github/workflows/i18n-push.yaml @@ -1,4 +1,4 @@ -name: 'Extract translations when there is a push to main, and upload them to Crowdin' +name: 'Push translations to Crowdin' on: workflow_dispatch: @@ -16,6 +16,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4