-
-
Notifications
You must be signed in to change notification settings - Fork 75
50 lines (38 loc) · 1.37 KB
/
check_localize_lines.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
45
46
47
48
49
name: Check Lines of Localize Files
on:
push:
jobs:
check_json_lines:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Dependencies
run: npm install jsonlint -g
- name: Check JSON Files
run: |
# Navigate to the root of the repository
cd $GITHUB_WORKSPACE
# Navigate to the languages directory
cd src/localize/languages
# Initialize a variable to store the expected line count
expected_lines=""
# Get the list of all JSON files and loop through them
for file in *.json; do
# Check the number of lines in the first file only
if [ -z "$expected_lines" ]; then
expected_lines=$(wc -l < "$file")
fi
# Check the line count of the current file
current_lines=$(wc -l < "$file")
# Compare the current file's line count with the expected line count
if [ "$current_lines" -ne "$expected_lines" ]; then
echo "ERROR: $file does not have the same number of lines as other JSON files."
exit 1
fi
done
echo "SUCCESS: All JSON files have$expected_lines lines."