ADD: New subject | Royaume de Monte-Carlo #140
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: Parser | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
parse_files: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name : "Install Python dependencies" | |
run : pip install Markdown reportlab selenium weasyprint==53.0 PyPDF2 | |
- name: "Parse markdown subjects" | |
run: | | |
for file in $(ls -d */) | |
do | |
if [ ! -d "$file/subject" ]; then | |
echo "::error file=$file,title="No subject folder."::$file" | |
continue | |
fi | |
if [ ! -f "$file/subject/data.txt" ]; then | |
echo "::error file=$file/subject,title="No subject data.txt."::$file/subject" | |
continue | |
fi | |
data=$(cat $file/subject/data.txt) | |
stable=$(echo "$data" | cut -d$'\n' -f4) | |
if [ "$stable" = "stable" ]; then | |
echo "::notice file=$file/mouli/data.txt,title="Marked as stable"::$file/mouli/data.txt" | |
continue | |
fi | |
title=$(echo "$data" | cut -d$'\n' -f1) | |
if [ -z "$title" ]; then | |
echo "::error file=$file/subject/data.txt,title="No title."::$file/subject/data.txt" | |
continue | |
fi | |
version=$(echo "$data" | cut -d$'\n' -f2) | |
if [ -z "$version" ]; then | |
echo "::error file=$file/subject/data.txt,title="No version."::$file/subject/data.txt" | |
continue | |
fi | |
campus=$(echo "$data" | cut -d$'\n' -f3) | |
if [ -z "$campus" ]; then | |
echo "::error file=$file/subject/data.txt,title="No campus."::$file/subject/data.txt" | |
continue | |
fi | |
md=$(ls $file/subject/*.md | head -n1) | |
if [ -z "$md" ]; then | |
echo "::error file=$file/subject,title="No markdown file."::$file/subject" | |
continue | |
fi | |
cd .github/workflows/parser && python3 cc_subjects.py "../../../$md" "$title" "$version" "$campus" && cd ../../.. | |
done | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions |