From 487816bd680d3a7f2c35990be6a048fe40bfad15 Mon Sep 17 00:00:00 2001 From: Francesco Lodolo Date: Thu, 26 Oct 2023 16:19:53 +0200 Subject: [PATCH] Add workflow to lint Fluent en-US files --- .github/fluent_linter_config.yml | 27 +++++++++++++++++++++ .github/requirements.txt | 1 + .github/workflows/fluent_linter.yml | 37 +++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 .github/fluent_linter_config.yml create mode 100644 .github/requirements.txt create mode 100644 .github/workflows/fluent_linter.yml diff --git a/.github/fluent_linter_config.yml b/.github/fluent_linter_config.yml new file mode 100644 index 0000000000000..a03205f445dbf --- /dev/null +++ b/.github/fluent_linter_config.yml @@ -0,0 +1,27 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# See https://github.com/mozilla-l10n/moz-fluent-linter/blob/main/src/fluent_linter/config.yml +# for details + +--- +ID01: + enabled: true + exclusions: + messages: [] + files: [] +ID02: + enabled: true + min_length: 9 + exclusions: + messages: [] + files: [] +CO01: + enabled: true + brands: + - Firefox + - Mozilla + exclusions: + files: [] + messages: [] diff --git a/.github/requirements.txt b/.github/requirements.txt new file mode 100644 index 0000000000000..5f8b68c5b877d --- /dev/null +++ b/.github/requirements.txt @@ -0,0 +1 @@ +moz-fluent-linter==0.4.* diff --git a/.github/workflows/fluent_linter.yml b/.github/workflows/fluent_linter.yml new file mode 100644 index 0000000000000..ef823a6da4a20 --- /dev/null +++ b/.github/workflows/fluent_linter.yml @@ -0,0 +1,37 @@ +name: Lint Fluent Reference Files +on: + push: + paths: + - 'l10n/en-US/**.ftl' + - '.github/fluent_linter_config.yml' + - '.github/workflows/fluent_linter.yml' + branches: + - master + pull_request: + paths: + - 'l10n/en-US/**.ftl' + - '.github/fluent_linter_config.yml' + - '.github/workflows/fluent_linter.yml' + branches: + - master + workflow_dispatch: +permissions: + contents: read + +jobs: + linter: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'pip' + - name: Install Python dependencies + run: | + pip install -r .github/requirements.txt + - name: Lint reference + run: | + moz-fluent-lint ./l10n/en-US --config .github/linter_config.yml