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