99jobs :
1010 check-commits :
1111 runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ issues : write
1215
1316 steps :
1417 - name : Checkout repository
4649 ["ksinji"]="강신지"
4750 )
4851
52+ # 멤버별 폴더명 매핑 (GitHub ID -> 폴더명)
53+ # 기본값은 GitHub ID와 동일, 다른 경우만 명시
54+ declare -A FOLDERS=(
55+ ["oncsr"]="khj20006"
56+ # 나머지는 GitHub ID와 동일하므로 생략
57+ )
58+
4959 # 탈퇴한 멤버 (체크 제외)
5060 GRADUATED=("03do-new30" "ShinHeeEul")
5161
@@ -56,21 +66,28 @@ jobs:
5666 for github_id in "${!MEMBERS[@]}"; do
5767 korean_name="${MEMBERS[$github_id]}"
5868
69+ # 폴더명 결정: FOLDERS에 정의되어 있으면 사용, 없으면 github_id 사용
70+ if [ -n "${FOLDERS[$github_id]}" ]; then
71+ folder_name="${FOLDERS[$github_id]}"
72+ else
73+ folder_name="$github_id"
74+ fi
75+
5976 # 해당 멤버의 폴더에서 어제 날짜의 커밋이 있는지 확인
6077 # author-date를 사용하여 한국 시간 기준으로 체크
6178 COMMITS=$(git log --all \
6279 --author-date-order \
6380 --since="$YESTERDAY 00:00:00 +0900" \
6481 --until="$YESTERDAY 23:59:59 +0900" \
6582 --pretty=format:"%H" \
66- -- "$github_id /" 2>/dev/null || echo "")
83+ -- "$folder_name /" 2>/dev/null || echo "")
6784
6885 if [ -z "$COMMITS" ]; then
69- echo "❌ $korean_name ($github_id): 커밋 없음"
86+ echo "❌ $korean_name ($github_id) [폴더: $folder_name] : 커밋 없음"
7087 NO_COMMIT_MEMBERS+=("$korean_name")
7188 else
7289 COMMIT_COUNT=$(echo "$COMMITS" | wc -l)
73- echo "✅ $korean_name ($github_id): $COMMIT_COUNT 개 커밋"
90+ echo "✅ $korean_name ($github_id) [폴더: $folder_name] : $COMMIT_COUNT 개 커밋"
7491 fi
7592 done
7693
@@ -97,36 +114,52 @@ jobs:
97114 echo "no_commit_list=$NO_COMMIT_LIST" >> $GITHUB_OUTPUT
98115 fi
99116
100- - name : Create Issue if there are missing commits
117+ # 이슈 생성 기능은 권한 문제로 주석 처리
118+ # Repository Settings > Actions > Workflow permissions를
119+ # "Read and write permissions"로 변경하면 사용 가능
120+
121+ # - name: Create Issue if there are missing commits
122+ # if: steps.check.outputs.no_commit_count != '0'
123+ # uses: actions/github-script@v7
124+ # with:
125+ # github-token: ${{ secrets.TOKEN || secrets.GITHUB_TOKEN }}
126+ # script: |
127+ # const yesterday = '${{ steps.check.outputs.yesterday }}';
128+ # const noCommitList = '${{ steps.check.outputs.no_commit_list }}'.split(',');
129+ # const count = '${{ steps.check.outputs.no_commit_count }}';
130+ #
131+ # const body = `## 📊 ${yesterday} 커밋 체크 결과
132+ #
133+ # **커밋하지 않은 멤버: ${count}명**
134+ #
135+ # ${noCommitList.map(name => `- ${name} (벌금 5,000원)`).join('\n')}
136+ #
137+ # ---
138+ #
139+ # 💰 총 벌금: ${parseInt(count) * 5000}원
140+ #
141+ # ⏰ 체크 시간: ${new Date().toLocaleString('ko-KR', { timeZone: 'Asia/Seoul' })}`;
142+ #
143+ # // 이슈 생성
144+ # await github.rest.issues.create({
145+ # owner: context.repo.owner,
146+ # repo: context.repo.repo,
147+ # title: `[${yesterday}] 커밋 미제출 알림`,
148+ # body: body,
149+ # labels: ['daily-check', 'penalty']
150+ # });
151+
152+ - name : Post detailed results
101153 if : steps.check.outputs.no_commit_count != '0'
102- uses : actions/github-script@v7
103- with :
104- github-token : ${{ secrets.GITHUB_TOKEN }}
105- script : |
106- const yesterday = '${{ steps.check.outputs.yesterday }}';
107- const noCommitList = '${{ steps.check.outputs.no_commit_list }}'.split(',');
108- const count = '${{ steps.check.outputs.no_commit_count }}';
109-
110- const body = `## 📊 ${yesterday} 커밋 체크 결과
111-
112- **커밋하지 않은 멤버: ${count}명**
113-
114- ${noCommitList.map(name => `- ${name} (벌금 5,000원)`).join('\n')}
115-
116- ---
117-
118- 💰 총 벌금: ${parseInt(count) * 5000}원
119-
120- ⏰ 체크 시간: ${new Date().toLocaleString('ko-KR', { timeZone: 'Asia/Seoul' })}`;
121-
122- // 이슈 생성
123- await github.rest.issues.create({
124- owner: context.repo.owner,
125- repo: context.repo.repo,
126- title: `[${yesterday}] 커밋 미제출 알림`,
127- body: body,
128- labels: ['daily-check', 'penalty']
129- });
154+ run : |
155+ echo "========================================="
156+ echo "❌ 커밋 미제출 알림"
157+ echo "========================================="
158+ echo "날짜: ${{ steps.check.outputs.yesterday }}"
159+ echo "미제출 인원: ${{ steps.check.outputs.no_commit_count }}명"
160+ echo "대상자: ${{ steps.check.outputs.no_commit_list }}"
161+ echo "총 벌금: $(($${{ steps.check.outputs.no_commit_count }} * 5000))원"
162+ echo "========================================="
130163
131164 - name : Print summary
132165 run : |
0 commit comments