1515 - name : Checkout TIL repository
1616 uses : actions/checkout@v3
1717 with :
18+ token : ${{ secrets.PROFILE_UPDATE_TOKEN }}
1819 path : TIL
1920
2021 - name : Count markdown files
@@ -25,34 +26,59 @@ jobs:
2526 echo "count=$count" >> $GITHUB_OUTPUT
2627 echo "Total articles: $count"
2728
29+ - name : Update TIL README
30+ run : |
31+ cd TIL
32+ ARTICLE_COUNT="${{ steps.count.outputs.count }}"
33+
34+ # TIL README.md에서 "_숫자 TILs and counting..._" 패턴을 찾아서 업데이트
35+ sed -i "s/_[0-9]* TILs and counting.../_$ARTICLE_COUNT TILs and counting.../g" README.md
36+
37+ echo "Updated TIL README article count to: $ARTICLE_COUNT"
38+
39+ - name : Commit and push TIL README if changed
40+ run : |
41+ cd TIL
42+ git config user.name "github-actions[bot]"
43+ git config user.email "github-actions[bot]@users.noreply.github.com"
44+
45+ if git diff --quiet; then
46+ echo "No changes to commit in TIL README"
47+ else
48+ git add README.md
49+ git commit -m "[AUTO] Update TIL article count to ${{ steps.count.outputs.count }}"
50+ git push
51+ echo "TIL README changes committed and pushed"
52+ fi
53+
2854 - name : Checkout profile repository
2955 uses : actions/checkout@v3
3056 with :
3157 repository : isGeekCode/isGeekCode
3258 token : ${{ secrets.PROFILE_UPDATE_TOKEN }}
3359 path : profile
3460
35- - name : Update README
61+ - name : Update Profile README
3662 run : |
3763 cd profile
3864 ARTICLE_COUNT="${{ steps.count.outputs.count }}"
3965
40- # README.md에서 "TIL (숫자 articles)" 패턴을 찾아서 업데이트
66+ # Profile README.md에서 "TIL (숫자 articles)" 패턴을 찾아서 업데이트
4167 sed -i "s/TIL ([0-9]* articles)/TIL ($ARTICLE_COUNT articles)/g" README.md
4268
43- echo "Updated article count to: $ARTICLE_COUNT"
69+ echo "Updated Profile README article count to: $ARTICLE_COUNT"
4470
45- - name : Commit and push if changed
71+ - name : Commit and push Profile README if changed
4672 run : |
4773 cd profile
4874 git config user.name "github-actions[bot]"
4975 git config user.email "github-actions[bot]@users.noreply.github.com"
5076
5177 if git diff --quiet; then
52- echo "No changes to commit"
78+ echo "No changes to commit in Profile README "
5379 else
5480 git add README.md
5581 git commit -m "[AUTO] Update TIL article count to ${{ steps.count.outputs.count }}"
5682 git push
57- echo "Changes committed and pushed"
83+ echo "Profile README changes committed and pushed"
5884 fi
0 commit comments