Skip to content

Commit

Permalink
readme, 목차 md는 제거, 그리고 문제가 되는 디렉토리 없는 경우, 디렉토리 생성 스크립트 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenPearls authored Aug 28, 2024
1 parent 48ba30d commit d747a5e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/Rename and Commit Markdown Files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@ jobs:
- name: Rename and Update Markdown files
run: |
for file in $(find developLog -type f -name '*.md'); do
# 파일의 디렉토리와 파일명 추출
for file in $(find developLog/* -type f -name '*.md' -not -path 'developLog/README.md' -not -path 'developLog/SUMMARY.md'); do
# 파일의 디렉토리 구조를 유지하면서 첫 번째 H1 제목을 추출하여 새 파일명 생성
dir=$(dirname "$file")
base_name=$(basename "$file" .md)
# 첫 번째 H1 제목을 추출하여 제목으로 사용
title=$(grep -m 1 '^#' "$file" | sed 's/^# //')
if [ -n "$title" ]; then
new_filename="$dir/$title.md"
# 파일 이름이 동일한 경우에는 mv 명령을 건너뜁니다
# 파일 이름이 동일한 경우에도 강제로 업데이트
if [ "$file" != "$new_filename" ]; then
echo "Renaming $file to $new_filename"
mv "$file" "$new_filename"
else
echo "No rename needed for $file"
echo "Updating timestamp for $file"
touch "$file" # 파일의 타임스탬프를 업데이트
fi
else
echo "No valid title found in $file, skipping."
Expand Down

0 comments on commit d747a5e

Please sign in to comment.