-
Notifications
You must be signed in to change notification settings - Fork 16
78 lines (66 loc) · 2.14 KB
/
build-check.yml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Build check
on:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Files that don't need translation check (space-separated)
IGNORE_FILES: "index.md download.md"
jobs:
deploy:
name: Build check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check documentation consistency
env:
IGNORE_FILES: "来杯咖啡.md"
run: |
# Convert IGNORE_FILES to array
IFS=' ' read -r -a ignore_array <<< "$IGNORE_FILES"
# Find all markdown files in docs directory
missing_files=0
while IFS= read -r file; do
# Get relative path from docs directory
rel_path="${file#docs/}"
# Check if file should be ignored
should_ignore=0
for ignore_file in "${ignore_array[@]}"; do
if [[ "$rel_path" == *"$ignore_file" ]]; then
should_ignore=1
break
fi
done
# Skip check if file should be ignored
if [ $should_ignore -eq 1 ]; then
echo "Ignoring file: ${rel_path}"
continue
fi
# Check if corresponding English translation exists
if [ ! -f "i18n/en/docusaurus-plugin-content-docs/current/${rel_path}" ]; then
echo "Missing English translation for: ${rel_path}"
missing_files=$((missing_files + 1))
fi
done < <(find docs -name "*.md" -type f)
# Exit with error if any files are missing
if [ $missing_files -gt 0 ]; then
echo "Error: Found ${missing_files} files without English translations"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Install dependencies
run: |
yarn
- name: Build website
run: |
make build