File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Update Profile README
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - ' **.md'
9+
10+ jobs :
11+ update-readme :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout TIL repository
16+ uses : actions/checkout@v3
17+ with :
18+ path : TIL
19+
20+ - name : Count markdown files
21+ id : count
22+ run : |
23+ cd TIL
24+ count=$(find . -name "*.md" -type f ! -name "README.md" | wc -l)
25+ echo "count=$count" >> $GITHUB_OUTPUT
26+ echo "Total articles: $count"
27+
28+ - name : Checkout profile repository
29+ uses : actions/checkout@v3
30+ with :
31+ repository : isGeekCode/isGeekCode
32+ token : ${{ secrets.PROFILE_UPDATE_TOKEN }}
33+ path : profile
34+
35+ - name : Update README
36+ run : |
37+ cd profile
38+ ARTICLE_COUNT="${{ steps.count.outputs.count }}"
39+
40+ # README.md에서 "TIL (숫자 articles)" 패턴을 찾아서 업데이트
41+ sed -i "s/TIL ([0-9]* articles)/TIL ($ARTICLE_COUNT articles)/g" README.md
42+
43+ echo "Updated article count to: $ARTICLE_COUNT"
44+
45+ - name : Commit and push if changed
46+ run : |
47+ cd profile
48+ git config user.name "github-actions[bot]"
49+ git config user.email "github-actions[bot]@users.noreply.github.com"
50+
51+ if git diff --quiet; then
52+ echo "No changes to commit"
53+ else
54+ git add README.md
55+ git commit -m "[AUTO] Update TIL article count to ${{ steps.count.outputs.count }}"
56+ git push
57+ echo "Changes committed and pushed"
58+ fi
You can’t perform that action at this time.
0 commit comments