-
Notifications
You must be signed in to change notification settings - Fork 85
35 lines (30 loc) · 1.26 KB
/
metadata-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
name: metadata check
on: [pull_request]
jobs:
metadata-check:
runs-on: ubuntu-latest
env:
PATH_REGEX: ^.+\/docs\/.+\/(ja|en)\/section\-[0-9]\/lesson\-[0-9]_.+\.md$
steps:
- uses: actions/checkout@v3
- name: check lesson count
run: |
for dir in docs/*/ja/
do
CONTENT="$(echo $dir | cut -d'/' -f2)"
MDSECTIONCOUNT=$(jq -c '.total_sections' < public/metadata/$CONTENT/description.json)
FSSECTIONCOUNT=$(find docs/$CONTENT/ja/ -type d -iname "section-*" | wc -l)
if (( $MDSECTIONCOUNT != $FSSECTIONCOUNT ))
then
echo "Update section count to $FSSECTIONCOUNT in public/$CONTENT/description.json (currently $MDSECTIONCOUNT)"
exit 1
fi
MDLESSONCOUNT=$(jq -c '.total_lessons' < public/metadata/$CONTENT/description.json)
FSLESSONCOUNT=$(find docs/$CONTENT/ja/ -type f ! -iname '.*' | wc -l)
if (( $MDLESSONCOUNT != $FSLESSONCOUNT ))
then
echo "Update lesson count to $FSLESSONCOUNT in public/$CONTENT/description.json (currently $MDLESSONCOUNT)"
exit 1
fi
echo "$CONTENT: $FSSECTIONCOUNT sections / $FSLESSONCOUNT lessons"
done