From 1f97c0db8caf4c990d2cb1d72900de40b3d8bea7 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Wed, 25 Jun 2025 14:47:10 +0100 Subject: [PATCH] Internationalisation: Use new shared verify-i18n workflow (#106928) * use new shared verify-i18n workflow * update CODEOWNERS * add empty permissions block * fix permissions * commit translations * rename workflow --- .github/CODEOWNERS | 1 + .github/workflows/frontend-lint.yml | 28 ---------------------------- .github/workflows/i18n-verify.yml | 15 +++++++++++++++ package.json | 1 + 4 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/i18n-verify.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8fb510dc44c..a9f8a040176 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -831,6 +831,7 @@ embed.go @grafana/grafana-as-code /.github/workflows/i18n-crowdin-upload.yml @grafana/grafana-frontend-platform /.github/workflows/i18n-crowdin-download.yml @grafana/grafana-frontend-platform /.github/workflows/i18n-crowdin-create-tasks.yml @grafana/grafana-frontend-platform +/.github/workflows/i18n-verify.yml @grafana/grafana-frontend-platform /.github/workflows/scripts/crowdin/create-tasks.ts @grafana/grafana-frontend-platform /.github/workflows/pr-go-workspace-check.yml @grafana/grafana-app-platform-squad /.github/workflows/pr-dependabot-update-go-workspace.yml @grafana/grafana-app-platform-squad diff --git a/.github/workflows/frontend-lint.yml b/.github/workflows/frontend-lint.yml index 29910d256f0..b9949fc74f6 100644 --- a/.github/workflows/frontend-lint.yml +++ b/.github/workflows/frontend-lint.yml @@ -9,34 +9,6 @@ on: permissions: {} jobs: - lint-frontend-verify-i18n: - name: Verify i18n - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - cache-dependency-path: 'yarn.lock' - - run: yarn install --immutable --check-cache - - run: | - # shellcheck disable=SC2102,SC2016,SC2125 # this is just a string. we _want_ all the bash features to be disabled. - extract_error_message='::error::Extraction failed. Make sure that you have no dynamic translation phrases, such as "t(`preferences.theme.{themeID}`, themeName)" and that no translation key is used twice. Search the output for '[warning]' to find the offending file.' - make i18n-extract || (echo "${extract_error_message}" && false) - - run: | - uncommited_error_message="::error::Translation extraction has not been committed. Please run 'make i18n-extract', commit the changes and push again." - file_diff=$(git diff --dirstat public/locales) - if [ -n "$file_diff" ]; then - echo "$file_diff" - echo "${uncommited_error_message}" - exit 1 - fi lint-frontend-prettier: permissions: contents: read diff --git a/.github/workflows/i18n-verify.yml b/.github/workflows/i18n-verify.yml new file mode 100644 index 00000000000..ccbed74d4ea --- /dev/null +++ b/.github/workflows/i18n-verify.yml @@ -0,0 +1,15 @@ +name: Verify i18n + +permissions: + contents: read + +on: + pull_request: + push: + branches: + - main + - release-*.*.* + +jobs: + verify-i18n: + uses: grafana/grafana-github-actions/.github/workflows/verify-i18n.yml@main diff --git a/package.json b/package.json index 5aaf956deea..dc482f9bfeb 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "watch": "yarn start -d watch,start core:start --watchTheme", "ci:test-frontend": "yarn run test:ci", "i18n:stats": "node ./scripts/cli/reportI18nStats.mjs", + "i18n-extract": "make i18n-extract", "betterer": "betterer --tsconfig ./scripts/cli/tsconfig.json", "betterer:stats": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/reportBettererStats.ts", "betterer:issues": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/generateBettererIssues.ts",