-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.77 KB
/
file_count.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 }}