Skip to content

Commit 3ef05ca

Browse files
authored
Update update-readme-calendar.yml
1 parent d7cd471 commit 3ef05ca

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

.github/workflows/update-readme-calendar.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Update README calendar (KST daily)
22

33
on:
44
schedule:
5-
# KST 00:02 = UTC 15:02 (전날)
5+
# KST 00:02 = UTC 15:02 (전날 기준)
66
- cron: '2 15 * * *'
77
workflow_dispatch: {}
88

@@ -14,33 +14,60 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- name: Checkout
17+
- name: Checkout (full history)
1818
uses: actions/checkout@v4
1919
with:
20-
fetch-depth: 0 # 달력 집계용으로 이전 커밋까지 모두 필요
20+
fetch-depth: 0 # 히스토리/스냅샷 계산에 필요
2121

22-
- name: Set timezone to Asia/Seoul
22+
- name: Set timezone & Git i18n (KST & UTF-8)
2323
run: |
2424
sudo timedatectl set-timezone Asia/Seoul
25+
git config --global core.quotepath false
26+
git config --global i18n.commitEncoding utf-8
27+
git config --global i18n.logOutputEncoding utf-8
2528
date
29+
locale
2630
2731
- name: Set up Python
2832
uses: actions/setup-python@v5
2933
with:
3034
python-version: '3.x'
3135

36+
# (선택) 어제 스냅샷 디버그 - 필요시 주석 해제해서 사용
37+
# - name: Debug snapshot (yesterday)
38+
# run: |
39+
# python3 - << 'PY'
40+
# import subprocess, datetime
41+
# def run(cmd):
42+
# print("$", cmd)
43+
# print(subprocess.check_output(cmd, shell=True, text=True, encoding="utf-8"))
44+
# KST = datetime.timezone(datetime.timedelta(hours=9))
45+
# y = (datetime.datetime.now(KST) - datetime.timedelta(days=1)).date().isoformat()
46+
# until = f'{y} 23:59:59 +0900'
47+
# commit = subprocess.check_output(f'git rev-list -1 --before="{until}" HEAD || true', shell=True, text=True).strip()
48+
# print("DATE:", y, "COMMIT:", commit)
49+
# for n in ["곽태근","김호집","오창은","김태민","추창우"]:
50+
# base = f"{y}/{n}".rstrip("/") + "/"
51+
# cmd = f'git ls-tree -r --name-only {commit} -- "{base}" || true'
52+
# run(cmd)
53+
# PY
54+
3255
- name: Generate calendar into README
3356
run: |
3457
python3 scripts/update_readme_calendar.py
3558
36-
- name: Commit & push if changed
59+
- name: Commit & push if README changed
3760
run: |
38-
if git diff --quiet README.md; then
61+
# README 변경 없으면 종료
62+
if git diff --quiet -- README.md; then
3963
echo "No changes in README.md"
4064
exit 0
4165
fi
66+
4267
git config user.name "github-actions[bot]"
4368
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
69+
70+
# 변경 내용 커밋/푸시
4471
git add README.md
4572
KST_NOW=$(date +'%Y-%m-%d %H:%M')
4673
git commit -m "README 달력 자동 업데이트: ${KST_NOW} KST"

0 commit comments

Comments
 (0)