Skip to content

Commit d442348

Browse files
authored
Add GitHub workflow to check Fluent reference files (#5647)
* Add workflow with Fluent linter * Fix linter error in CircleCI * Fix path to workflow in paths * Use explicit requirements.txt file See actions/setup-python#807 The alternative (creating an empty file) seems worse than using an actual requirements file. * Reorganize files, address review comments * Fix pip cache
1 parent 9e4beb7 commit d442348

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

.github/fluent/linter_config.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
# See https://github.com/mozilla-l10n/moz-fluent-linter/blob/main/src/fluent_linter/config.yml
6+
# for details
7+
8+
---
9+
# Check brand names
10+
CO01:
11+
enabled: true
12+
brands:
13+
- Firefox
14+
- Mozilla
15+
- Profiler
16+
exclusions:
17+
files: []
18+
messages: []
19+
# Enforce variable comments
20+
VC:
21+
disabled: false
22+
# Enforce placeholder style, e.g. { $variable }
23+
PS01:
24+
disabled: false

.github/fluent/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
moz-fluent-linter~=0.4.9
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint Reference Files
2+
on:
3+
push:
4+
paths:
5+
- 'locales/en-US/*.ftl'
6+
- '.github/workflows/fluent_linter.yml'
7+
- '.github/fluent/*'
8+
branches:
9+
- main
10+
pull_request:
11+
paths:
12+
- 'locales/en-US/*.ftl'
13+
- '.github/workflows/fluent_linter.yml'
14+
- '.github/fluent/*'
15+
branches:
16+
- main
17+
workflow_dispatch:
18+
jobs:
19+
linter:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Clone repository
23+
uses: actions/checkout@v5
24+
- name: Set up Python 3
25+
uses: actions/setup-python@v6
26+
with:
27+
python-version: '3.11'
28+
cache: 'pip'
29+
cache-dependency-path: '.github/fluent/requirements.txt'
30+
- name: Install Python dependencies
31+
run: |
32+
pip install -r .github/fluent/requirements.txt
33+
- name: Lint reference
34+
run: |
35+
moz-fluent-lint ./locales/en-US --config .github/fluent/linter_config.yml

0 commit comments

Comments
 (0)