Skip to content

Commit 1e7982e

Browse files
committed
docs: 합류 전후 누적금액 표 추가
1 parent 7cdfe68 commit 1e7982e

2 files changed

Lines changed: 63 additions & 20 deletions

File tree

.github/scripts/check_commits.py

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,33 +134,57 @@ def create_issue(github, repo, participant_name, date_str, penalty_type, amount)
134134
return None
135135

136136
def update_readme_penalty(participant_name, amount=5000):
137-
"""README.md의 누적 적립금을 업데이트합니다."""
137+
"""README.md의 합류 후 누적 적립금을 업데이트합니다."""
138138
# README.md 경로 확인 (src/README.md 또는 README.md)
139139
readme_path = 'src/README.md' if os.path.exists('src/README.md') else 'README.md'
140-
140+
141141
try:
142142
with open(readme_path, 'r', encoding='utf-8') as f:
143143
content = f.read()
144-
145-
# 누적 적립금 섹션 찾기
144+
145+
# 합류 후 섹션만 찾기
146+
section_pattern = r'(<!-- 합류후_START -->)(.*?)(<!-- 합류후_END -->)'
147+
section_match = re.search(section_pattern, content, re.DOTALL)
148+
149+
if not section_match:
150+
print(f"❌ 실패: 합류 후 테이블 섹션을 찾을 수 없습니다.")
151+
return False
152+
153+
section = section_match.group(2)
154+
155+
# 해당 참여자의 금액 업데이트
146156
pattern = rf'(\| {re.escape(participant_name)} \| )(\d+)원'
147-
157+
148158
def replace_amount(match):
149159
current_amount = int(match.group(2))
150160
new_amount = current_amount + amount
151161
return f'{match.group(1)}{new_amount}원'
152-
153-
new_content = re.sub(pattern, replace_amount, content)
154-
155-
if new_content != content:
156-
with open(readme_path, 'w', encoding='utf-8') as f:
157-
f.write(new_content)
158-
# 로그는 호출하는 쪽에서 출력하므로 여기서는 출력하지 않음
159-
return True
160-
else:
162+
163+
new_section = re.sub(pattern, replace_amount, section)
164+
165+
if new_section == section:
161166
print(f"❌ 실패: {participant_name}님을 찾을 수 없습니다.")
162167
return False
163-
168+
169+
# 총액 재계산 (테이블 행에서만 추출)
170+
amounts = re.findall(r'^\| \S+ \| (\d+)원', new_section, re.MULTILINE)
171+
total = sum(int(a) for a in amounts)
172+
173+
# 총액 업데이트
174+
new_section = re.sub(
175+
r'\*\*총 추가 회식비: [\d,]+원\*\*',
176+
f'**총 추가 회식비: {total:,}원**',
177+
new_section
178+
)
179+
180+
# 섹션을 원본에 다시 넣기
181+
new_content = content[:section_match.start(2)] + new_section + content[section_match.end(2):]
182+
183+
with open(readme_path, 'w', encoding='utf-8') as f:
184+
f.write(new_content)
185+
# 로그는 호출하는 쪽에서 출력하므로 여기서는 출력하지 않음
186+
return True
187+
164188
except Exception as e:
165189
print(f"README.md 업데이트 중 오류 발생: {e}")
166190
return False

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ algorithm/
5151

5252
## 자동 커밋 체크 & 벌금 시스템 (GitHub Actions)
5353

54+
5455
- GitHub Actions 워크플로우 `Check Daily Commits`**매일 12:00 (KST)**에 실행됩니다.
5556
- 전날(평일 기준) 각 **참여자의 커밋 여부**를 확인합니다.
5657
- 커밋이 없으면 자동으로 Issue를 생성합니다.
@@ -73,19 +74,37 @@ algorithm/
7374

7475
## 회식비 제공 천사 🪽
7576

77+
### 이용훈, 최어진 합류 전
78+
7679
| 이름 | 누적 |
7780
| ------ | ---- |
78-
| 박예진 | 10000원 |
81+
| 박예진 | 5000원 |
7982
| 김지호 | 15000원 |
8083
| 심수연 | 0원 |
8184
| 정건우 | 0원 |
82-
| 공예영 | 43000원 |
83-
| 서정우 | 20000원 |
84-
| 허현빈 | 20000원 |
85+
| 공예영 | 33000원 |
86+
| 서정우 | 10000원 |
87+
| 허현빈 | 15000원 |
88+
89+
**소계: 78,000원**
90+
91+
### 이용훈, 최어진 합류 후
92+
93+
<!-- 합류후_START -->
94+
| 이름 | 누적 |
95+
| ------ | ---- |
96+
| 박예진 | 5000원 |
97+
| 김지호 | 0원 |
98+
| 심수연 | 0원 |
99+
| 정건우 | 0원 |
100+
| 공예영 | 10000원 |
101+
| 서정우 | 10000원 |
102+
| 허현빈 | 5000원 |
85103
| 이용훈 | 10000원 |
86104
| 최어진 | 5000원 |
87105

88-
**총 회식비: 78,000원**
106+
**총 추가 회식비: 45,000원**
107+
<!-- 합류후_END -->
89108

90109
---
91110

0 commit comments

Comments
 (0)