Skip to content

Commit f7ac77a

Browse files
Gyuhyeok99claude
andcommitted
feat: 자동 이슈 생성에 중복 체크 로직 추가
- 같은 제목의 이슈가 이미 존재하면 생성 건너뛰기 - weekly-challenge 라벨이 있는 이슈 검색 - 중복 방지로 안전한 자동화 구현 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 66f94f1 commit f7ac77a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/auto-weekly-issue.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,36 @@ jobs:
2929
echo "start_date=$START_DATE" >> $GITHUB_OUTPUT
3030
echo "end_date=$END_DATE" >> $GITHUB_OUTPUT
3131
32+
- name: Check for duplicate issue
33+
id: check
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
const weekNumber = '${{ steps.calc.outputs.week_number }}';
38+
const startDate = '${{ steps.calc.outputs.start_date }}';
39+
const endDate = '${{ steps.calc.outputs.end_date }}';
40+
const expectedTitle = `[Week${weekNumber}] ${startDate} ~ ${endDate} 주차 문제`;
41+
42+
// 열려있는 이슈 중에서 같은 제목이 있는지 확인
43+
const { data: issues } = await github.rest.issues.listForRepo({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
state: 'all',
47+
labels: 'weekly-challenge'
48+
});
49+
50+
const duplicate = issues.find(issue => issue.title === expectedTitle);
51+
52+
if (duplicate) {
53+
console.log(`⚠️ Issue already exists: ${duplicate.html_url}`);
54+
return 'skip';
55+
} else {
56+
console.log(`✅ No duplicate found. Proceeding to create issue.`);
57+
return 'create';
58+
}
59+
3260
- name: Create weekly issue
61+
if: steps.check.outputs.result == 'create'
3362
uses: actions/github-script@v7
3463
with:
3564
script: |

0 commit comments

Comments
 (0)