Skip to content

Update README with updated SUMMARY.md content #267

Update README with updated SUMMARY.md content

Update README with updated SUMMARY.md content #267

name: Rename and Add New Markdown Files
on:
push:
branches:
- main
workflow_dispatch:
jobs:
process-markdown:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITBOOKKEY }}
fetch-depth: 0
- name: Set UTF-8 Encoding
run: |
export LC_CTYPE="UTF-8"
- name: Rename and Copy Markdown files to koreanPageTitle, Rename Folders Based on README H1
run: |
for file in $(find developLog -type f -name '*.md'); do
# Markdown 파일 볡사 및 이름 λ³€κ²½
if [[ "$file" == *"README.md" ]] || [[ "$file" == *"SUMMARY.md" ]]; then
echo "Skipping $file"
continue
fi
title=$(grep -m 1 '^#' "$file" | sed 's/^# //')
if [ -n "$title" ]; then
dir=$(dirname "$file")
new_dir="koreanPageTitle/$dir"
new_filename="$new_dir/$title.md"
mkdir -p "$new_dir"
if [ -f "$new_filename" ]; then
if cmp -s "$file" "$new_filename"; then
echo "File $new_filename already exists and is identical. Skipping..."
else
echo "File $new_filename already exists but is different. Overwriting with new file."
cp "$file" "$new_filename"
fi
else
echo "Copying $file to $new_filename"
cp "$file" "$new_filename"
fi
else
echo "No valid title found in $file, skipping."
fi
done
# .gitbook/assets 디렉토리 볡사
if [ -d "developLog/.gitbook/assets" ]; then
mkdir -p "koreanPageTitle/developLog/.gitbook/assets"
cp -r developLog/.gitbook/assets/* koreanPageTitle/developLog/.gitbook/assets/
echo ".gitbook/assets directory copied to koreanPageTitle/developLog"
fi
- name: Commit changes in koreanPageTitle
run: |
cd koreanPageTitle
git init
git add -A
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m "Rename and update Markdown files based on h1 titles in koreanPageTitle"
git push https://${{ secrets.GITBOOKKEY }}@github.com/GoldenPearls/gitBook.git master:koreanPageTitle --force