From 0a5a86f20b014193ee6a663ebfdcbfcb24ed3084 Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Wed, 15 Nov 2023 16:21:30 +0000 Subject: [PATCH] I18n: Github action to fix up i18n files in Crowdin files (#78191) * I18n: Start github action to fix up i18n files after crowdin push * finish action * change message * actions --- .github/CODEOWNERS | 1 + .github/workflows/i18n-crowdin-fix-files.yml | 46 ++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/i18n-crowdin-fix-files.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4ee55d32f63..8687beaf90f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -667,6 +667,7 @@ embed.go @grafana/grafana-as-code /.github/workflows/ephemeral-instances-pr-opened-closed.yml @grafana/grafana-operator-experience-squad /.github/workflows/create-security-patch-from-security-mirror.yml @grafana/grafana-delivery /.github/workflows/core-plugins-build-and-release.yml @grafana/plugins-platform-frontend @grafana/plugins-platform-backend +/.github/workflows/i18n-crowdin-fix-files.yml @grafana/grafana-frontend-platform # Generated files not requiring owner approval /packages/grafana-data/src/types/featureToggles.gen.ts @grafanabot diff --git a/.github/workflows/i18n-crowdin-fix-files.yml b/.github/workflows/i18n-crowdin-fix-files.yml new file mode 100644 index 00000000000..c96a8a14e8f --- /dev/null +++ b/.github/workflows/i18n-crowdin-fix-files.yml @@ -0,0 +1,46 @@ +# When Crowdin creates a pull request from the crowdin-service-branch branch, +# run `yarn i18n:extract` and commit the changed grafana.json files back into the PR +# to reformat crowdin's changes to prevent conflicts with our CI checks. + +name: Fix Crowdin I18n files + +on: + pull_request: + paths: + - 'public/locales/*/grafana.json' + branches: + - main # Only run on pull requests *target* main (will be merged into main) + +jobs: + fix-files: + # Only run on pull requests *from* the crowdin-service-branch branch + if: github.head_ref == 'crowdin-service-branch' + + name: Fix files + runs-on: ubuntu-latest + + # write permission needed to commit changes back in + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - uses: actions/setup-node@v4 + with: + node-version: 20.9.0 + cache: 'yarn' + + - name: Install dependencies + run: yarn install + + - name: Extract I18n files + run: yarn i18n:extract + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Github Action: Auto-fix i18n files" + file_pattern: public/locales/*/grafana.json