Skip to content

Commit 9259a85

Browse files
committed
[UPDATE] TIL README도 자동 업데이트하도록 workflow 개선
- TIL 저장소 README의 '_숫자 TILs and counting..._' 자동 업데이트 - 프로필 저장소 README의 'TIL (숫자 articles)' 자동 업데이트 - 두 저장소 모두 자동으로 커밋 & 푸시
1 parent af3b284 commit 9259a85

2 files changed

Lines changed: 35 additions & 7 deletions

File tree

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"Bash(done)",
2626
"Bash(tree -L 2 -a:*)",
2727
"Bash(du -sh:*)",
28-
"Bash(tree:*)"
28+
"Bash(tree:*)",
29+
"Bash(git rm:*)",
30+
"Bash(git stash:*)"
2931
],
3032
"deny": [],
3133
"ask": []

.github/workflows/update-profile.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
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

Comments
 (0)