Add ja contents #97
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |