Skip to content

[level 0] Title: 옹알이 (1), Time: 0.25 ms, Memory: 33.4 MB -BaekjoonHub #416

[level 0] Title: 옹알이 (1), Time: 0.25 ms, Memory: 33.4 MB -BaekjoonHub

[level 0] Title: 옹알이 (1), Time: 0.25 ms, Memory: 33.4 MB -BaekjoonHub #416

Workflow file for this run

name: Update README
on:
push:
branches:
- main
paths-ignore:
- '**/*.yml'
jobs:
update-readme:
if: contains(github.event.head_commit.message, '[level')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update README.md
run: |
README_FILE="README.md"
echo "# 알고리즘 풀이 [![My Skills](https://skillicons.dev/icons?i=js,python,mysql&theme=dark)](https://skillicons.dev)" > $README_FILE
echo "> _Readme는 자동으로 갱신되며 현재는 프로그래머스 문제만 정리하고 있습니다._" >> $README_FILE
echo "" >> $README_FILE
declare -A languages=( ["JavaScript"]="js" ["Python"]="py" ["SQL"]="sql" )
for lang in "${!languages[@]}"; do
ext="${languages[$lang]}"
echo "## $lang" >> $README_FILE
# 각 레벨 탐색 (0, 1, 2...)
for level_dir in $(find 프로그래머스 -mindepth 1 -maxdepth 1 -type d | sort); do
level=$(basename "$level_dir")
found=false
table="| No.# | 문제 번호(풀이) | 푼 횟수 | 해결 여부 | 최근 푼 날짜 |\n| :--: | :--------: | :------: | :------: | :---------: |"
count=1
# 문제 디렉토리 순회
for problem_dir in $(find "$level_dir" -mindepth 1 -maxdepth 1 -type d | sort); do
file_path=$(find "$problem_dir" -type f -name "*.$ext" | head -n 1)
if [ -n "$file_path" ]; then
found=true
problem_id=$(basename "$problem_dir")
commit_count=$(git rev-list --count HEAD -- "$file_path")
latest_date=$(git log -1 --date=short --pretty=format:"%ad" -- "$file_path")
link="https://github.com/${{ github.repository }}/tree/main/$problem_dir"
table+="\n| $count | [$problem_id]($link) | $commit_count | O | $latest_date |"
count=$((count + 1))
fi
done
if $found; then
echo "" >> $README_FILE
echo "### Level $level" >> $README_FILE
echo "<details>" >> $README_FILE
echo "<summary>더 자세히</summary>" >> $README_FILE
echo "<div markdown="1">" >> $README_FILE
echo "" >> $README_FILE
echo -e "$table" >> $README_FILE
echo "" >> $README_FILE
echo "<br>" >> $README_FILE
echo "</div>" >> $README_FILE
echo "</details>" >> $README_FILE
echo "" >> $README_FILE
fi
done
echo "" >> $README_FILE
done
# Git commit & push
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add $README_FILE
git commit -m "Auto-update README with latest problem stats" || echo "No changes to commit"
- name: Push changes
run: git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}