[Silver II] Title: DNA 비밀번호, Time: 240 ms, Memory: 22128 KB -BaekjoonHub #33
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: File Count and Update README | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
count_files_and_update_readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Count Files and Generate Markdown Bar Chart | |
run: | | |
# 파일 수 계산 | |
java_count=$(find . -type f -name "*.java" | wc -l) | |
sql_count=$(find . -type f -name "*.sql" | wc -l) | |
undefined_count=$(find . -type f -not -name "*.*" | wc -l) | |
total_files=$(find . -type f | wc -l) | |
java_ratio=$(echo "scale=2; $java_count/$total_files*100" | bc) | |
sql_ratio=$(echo "scale=2; $sql_count/$total_files*100" | bc) | |
undefined_ratio=$(echo "scale=2; $undefined_count/$total_files*100" | bc) | |
# 마크다운 바 차트 생성 | |
bar_chart="Java files ($java_ratio%): " | |
for i in $(seq 1 $java_ratio); do bar_chart+="█"; done | |
bar_chart+=" $java_ratio%<br/>SQL files ($sql_ratio%): " | |
for i in $(seq 1 $sql_ratio); do bar_chart+="█"; done | |
bar_chart+=" $sql_ratio%<br/>Undefined files ($undefined_ratio%): " | |
for i in $(seq 1 $undefined_ratio); do bar_chart+="█"; done | |
bar_chart+=" $undefined_ratio%" | |
# README 업데이트 | |
sed -i "/<!-- file_counts_start -->/,/<!-- file_counts_end -->/c\<!-- file_counts_start -->\n$bar_chart\n<!-- file_counts_end -->" README.md | |
- name: Commit and Push README Updates | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m "Update file counts and bar chart in README" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |