Skip to content

Commit d94b459

Browse files
committed
feat: 지각자 처리 없애기
1 parent 4050d85 commit d94b459

3 files changed

Lines changed: 23 additions & 88 deletions

File tree

.github/scripts/check_commits.py

Lines changed: 20 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env python3
22
"""
3-
매일 01:00에 실행되어 각 참여자의 커밋을 확인하고,
3+
매일 00:00에 실행되어 각 참여자의 커밋을 확인하고,
44
- 어제 커밋이 없는 경우: 벌금 5000원
5-
- 어제 커밋이 없었는데 오늘 00:00~01:00 사이에 커밋한 경우: 지각 3000원
65
Issue를 생성하고 README.md의 누적 적립금을 업데이트합니다.
76
"""
87

@@ -100,27 +99,9 @@ def check_user_commits(github, repo, participant_name, username, start_time, end
10099
return False
101100

102101
def create_issue(github, repo, participant_name, date_str, penalty_type, amount):
103-
"""미제출자 또는 지각자에 대한 Issue를 생성합니다."""
104-
if penalty_type == 'late':
105-
title = f"⏰ {date_str} 지각: {participant_name}"
106-
body = f"""
107-
## 지각 알림
108-
109-
**날짜**: {date_str}
110-
**참여자**: {participant_name}
111-
112-
{participant_name}님은 {date_str}에 커밋이 없었지만, 다음 날 00:00~01:00 사이에 커밋을 완료했습니다.
113-
114-
스터디 규칙에 따라 **3,000원**이 누적 적립금에 추가되었습니다.
115-
116-
---
117-
118-
*이 Issue는 자동으로 생성되었습니다.*
119-
"""
120-
labels = ['지각', '자동생성']
121-
else: # penalty_type == 'no_commit'
122-
title = f"⚠️ {date_str} 미제출: {participant_name}"
123-
body = f"""
102+
"""미제출자에 대한 Issue를 생성합니다."""
103+
title = f"⚠️ {date_str} 미제출: {participant_name}"
104+
body = f"""
124105
## 미제출 알림
125106
126107
**날짜**: {date_str}
@@ -134,7 +115,7 @@ def create_issue(github, repo, participant_name, date_str, penalty_type, amount)
134115
135116
*이 Issue는 자동으로 생성되었습니다.*
136117
"""
137-
labels = ['미제출', '자동생성']
118+
labels = ['미제출', '자동생성']
138119

139120
try:
140121
issue = repo.create_issue(
@@ -200,7 +181,7 @@ def main():
200181
return
201182

202183
# 확인할 날짜 (어제 날짜, 한국 시간 기준)
203-
# 워크플로우가 01:00에 실행되므로 어제 날짜의 커밋을 확인
184+
# 워크플로우가 00:00에 실행되므로 어제 날짜의 커밋을 확인
204185
today = get_today_kst()
205186
yesterday = today - timedelta(days=1)
206187
date_str = yesterday.strftime('%Y년 %m월 %d일')
@@ -221,56 +202,33 @@ def main():
221202
# 어제 날짜의 시간 범위 (00:00:00 ~ 23:59:59)
222203
yesterday_start = datetime.combine(yesterday, datetime.min.time()).replace(tzinfo=KST)
223204
yesterday_end = datetime.combine(today, datetime.min.time()).replace(tzinfo=KST) # 오늘 00:00:00
224-
225-
# 오늘 00:00~01:00 사이의 시간 범위 (지각 체크용)
226-
from datetime import time as dt_time
227-
today_start = datetime.combine(today, dt_time(0, 0, 0)).replace(tzinfo=KST) # 오늘 00:00:00
228-
today_01_00 = datetime.combine(today, dt_time(1, 0, 0)).replace(tzinfo=KST) # 오늘 01:00:00
229-
205+
230206
no_commit_participants = [] # 어제 커밋이 없는 사람들
231-
late_participants = [] # 어제 커밋이 없었는데 오늘 00:00~01:00 사이에 커밋한 사람들
232207

233208
# 각 참여자의 커밋 확인
234209
print(f"\n📋 총 {len(PARTICIPANTS)}명의 참여자 커밋 확인 시작\n")
235210

236211
for idx, (name, github_username) in enumerate(PARTICIPANTS.items(), 1):
237212
print(f"[{idx}/{len(PARTICIPANTS)}] Checking {name} (@{github_username})...")
238-
213+
239214
# 어제 커밋 확인
240215
print(f" → 어제 ({yesterday.strftime('%Y-%m-%d')}) 커밋 확인 중...", end=" ")
241216
has_yesterday_commit = check_user_commits(g, repo, name, github_username, yesterday_start, yesterday_end)
242-
217+
243218
if not has_yesterday_commit:
244-
print("❌ 없음")
219+
print("❌ 없음 (미제출)")
245220
no_commit_participants.append(name)
246-
247-
# 오늘 00:00~01:00 사이에 커밋이 있는지 확인 (지각 체크)
248-
print(f" → 오늘 00:00~01:00 사이 커밋 확인 중...", end=" ")
249-
has_today_early_commit = check_user_commits(g, repo, name, github_username, today_start, today_01_00)
250-
251-
if has_today_early_commit:
252-
print("✅ 있음 (지각)")
253-
late_participants.append(name)
254-
else:
255-
print("❌ 없음 (미제출)")
256221
else:
257222
print("✅ 있음")
258223
print(f" → 상태: 정상 완료")
259224

260-
# 처리할 참여자들
261-
penalty_participants = [] # 벌금 5000원 (어제 커밋 없음 + 오늘 00:00~01:00 사이에도 커밋 없음)
262-
263-
for participant in no_commit_participants:
264-
if participant not in late_participants:
265-
penalty_participants.append(participant)
266-
267225
# 벌금 처리 (어제 커밋 없음 = 5000원)
268-
if penalty_participants:
226+
if no_commit_participants:
269227
print(f"\n{'='*60}")
270-
print(f"⚠️ 미제출자 {len(penalty_participants)}명 발견 (벌금 5,000원)")
228+
print(f"⚠️ 미제출자 {len(no_commit_participants)}명 발견 (벌금 5,000원)")
271229
print(f"{'='*60}")
272-
273-
for participant_name in penalty_participants:
230+
231+
for participant_name in no_commit_participants:
274232
print(f"\n📌 처리 중: {participant_name}")
275233
print(f" → Issue 생성 중...", end=" ")
276234
# Issue 생성
@@ -282,26 +240,8 @@ def main():
282240
else:
283241
print("❌ 실패")
284242

285-
# 지각 처리 (어제 커밋 없음 + 오늘 00:00~01:00 사이 커밋 있음 = 3000원)
286-
if late_participants:
287-
print(f"\n{'='*60}")
288-
print(f"⏰ 지각자 {len(late_participants)}명 발견 (지각 3,000원)")
289-
print(f"{'='*60}")
290-
291-
for participant_name in late_participants:
292-
print(f"\n📌 처리 중: {participant_name}")
293-
print(f" → Issue 생성 중...", end=" ")
294-
# Issue 생성
295-
create_issue(g, repo, participant_name, date_str, 'late', 3000)
296-
print(f" → README.md 업데이트 중...", end=" ")
297-
# README.md 업데이트
298-
if update_readme_penalty(participant_name, 3000):
299-
print("✅ 완료")
300-
else:
301-
print("❌ 실패")
302-
303243
# 변경사항 커밋
304-
if penalty_participants or late_participants:
244+
if no_commit_participants:
305245
print(f"\n{'='*60}")
306246
print(f"💾 README.md 변경사항 커밋 중...")
307247
print(f"{'='*60}")
@@ -311,23 +251,19 @@ def main():
311251
subprocess.run(['git', 'config', 'user.name', 'github-actions[bot]'], check=True)
312252
subprocess.run(['git', 'config', 'user.email', 'github-actions[bot]@users.noreply.github.com'], check=True)
313253
print("✅ 완료")
314-
254+
315255
print(f" → 파일 스테이징 중...", end=" ")
316256
# README.md 경로 확인
317257
readme_git_path = 'src/README.md' if os.path.exists('src/README.md') else 'README.md'
318258
subprocess.run(['git', 'add', readme_git_path], check=True)
319259
print("✅ 완료")
320-
321-
commit_message = f'[자동] {date_str} 누적 적립금 업데이트'
322-
if penalty_participants:
323-
commit_message += f' (미제출: {", ".join(penalty_participants)})'
324-
if late_participants:
325-
commit_message += f' (지각: {", ".join(late_participants)})'
326-
260+
261+
commit_message = f'[자동] {date_str} 누적 적립금 업데이트 (미제출: {", ".join(no_commit_participants)})'
262+
327263
print(f" → 커밋 생성 중...", end=" ")
328264
subprocess.run(['git', 'commit', '-m', commit_message], check=True)
329265
print("✅ 완료")
330-
266+
331267
print(f" → 원격 저장소에 푸시 중...", end=" ")
332268
subprocess.run(['git', 'push'], check=True)
333269
print("✅ 완료")

.github/workflows/check-commits.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Check Daily Commits
22

33
on:
44
schedule:
5-
# 매일 01:00 (UTC 기준, 한국시간 오전 10시)
6-
# 한국시간 01:00으로 하려면: cron: '0 16 * * *' (UTC 16시 = 한국시간 01:00)
7-
- cron: "0 16 * * *"
5+
# 매일 00:00 (UTC 기준, 한국시간 오전 9시)
6+
# 한국시간 00:00으로 하려면: cron: '0 15 * * *' (UTC 15시 = 한국시간 00:00)
7+
- cron: "0 15 * * *"
88
workflow_dispatch: # 수동 실행도 가능하도록
99

1010
permissions:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
- **문제 풀이**: 매일 1문제씩 (평일만, 주말 제외 / 난이도 무관)
77
- **제출 마감**: 당일 23:59까지
88
- **벌금**: 박예진(통장)에게 입금, 추후 회식비로 사용
9-
- 지각 (1시간 이내): 3,000원
109
- 미제출: 5,000원
1110

1211
평일로 습관 잡힌 후 주말로 확장 예정

0 commit comments

Comments
 (0)