From ff0b30cfd425104b3575051aff493f5a12f4d684 Mon Sep 17 00:00:00 2001 From: David Dreschner Date: Sat, 28 Nov 2026 14:37:28 +0100 Subject: [PATCH] feat(workflows): add a template linting translation source strings Bad source strings are only noticed after the nightly sync has pushed them to Transifex. The template runs translationtool's lint-source-strings on every pull request, against the base branch, so only strings the pull request adds are checked and existing ones never block it. It uses the translations image as latest, like the other templates use the org's CI images, so it works once that image includes lint-source-strings. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: David Dreschner --- .../lint-translations.properties.json | 14 +++ workflow-templates/lint-translations.yml | 90 +++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 workflow-templates/lint-translations.properties.json create mode 100644 workflow-templates/lint-translations.yml diff --git a/workflow-templates/lint-translations.properties.json b/workflow-templates/lint-translations.properties.json new file mode 100644 index 00000000..cc6b8a04 --- /dev/null +++ b/workflow-templates/lint-translations.properties.json @@ -0,0 +1,14 @@ +{ + "name": "Linting translation source strings", + "description": "Checks the source strings a pull request adds against the translation guidelines of the developer manual", + "iconName": "octicon globe", + "categories": [ + "JavaScript", + "PHP", + "TypeScript", + "Vue" + ], + "filePatterns": [ + "^\\.tx/config$" + ] +} diff --git a/workflow-templates/lint-translations.yml b/workflow-templates/lint-translations.yml new file mode 100644 index 00000000..55ae26be --- /dev/null +++ b/workflow-templates/lint-translations.yml @@ -0,0 +1,90 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Lint translations + +on: pull_request + +permissions: + contents: read + +concurrency: + group: lint-translations-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + + outputs: + src: ${{ steps.changes.outputs.src }} + + steps: + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - '**/.l10nignore' + - '**/appinfo/info.xml' + - '**.html' + - '**.js' + - '**.jsx' + - '**.mjs' + - '**.php' + - '**.py' + - '**.ts' + - '**.tsx' + - '**.vue' + + source-strings: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + + container: ghcr.io/nextcloud/continuous-integration-translations:latest # zizmor: ignore[unpinned-images] + + name: Source strings + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + path: head + + - name: Checkout base branch + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + ref: ${{ github.event.pull_request.base.sha }} + path: base + + - name: Lint the source strings added by this pull request + working-directory: head + run: /translationtool.phar lint-source-strings --base=../base --format=github + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: [changes, source-strings] + + if: always() + + name: lint-translations + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.source-strings.result != 'success' }}; then exit 1; fi