-
Notifications
You must be signed in to change notification settings - Fork 46
44 lines (44 loc) · 1.37 KB
/
reference_linter.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Lint Reference Files
on:
push:
branches:
- main
paths:
- '.github/linter_config.yml'
- 'locale/en/**.ftl'
pull_request:
branches:
- main
paths:
- '.github/linter_config.yml'
- 'locale/en/**.ftl'
workflow_dispatch:
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v5
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 ./locale/en --config .github/linter_config.yml
- name: Check for unchanged IDs
run: |
diff=$( git diff --name-only ${{ github.event.pull_request.base.sha }} $GITHUB_SHA )
for file in $diff; do
mkdir -p "temp_base/${file%/*}/" && mkdir -p "temp_head/${file%/*}/"
git show ${{ github.event.pull_request.base.sha }}:$file > temp_base/$file
git show $GITHUB_SHA:$file > temp_head/$file
done
python .github/scripts/detect_unchanged_ids.py --base_dir temp_base --head_dir temp_head --locale_dir locale/en
if: github.event_name == 'pull_request'