Skip to content

Commit 72da6ba

Browse files
Gyuhyeok99claude
andcommitted
fix: 수동 이슈 생성에도 중복 체크 추가
- create-weekly-issue.yml에 중복 체크 로직 추가 - 같은 이슈가 있으면 워크플로우 실패로 표시 - 이제 모든 이슈 생성 워크플로우가 중복 방지됨 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f7ac77a commit 72da6ba

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,37 @@ jobs:
2323
issues: write
2424

2525
steps:
26+
- name: Check for duplicate issue
27+
id: check
28+
uses: actions/github-script@v7
29+
with:
30+
script: |
31+
const weekNumber = '${{ inputs.week_number }}';
32+
const startDate = '${{ inputs.start_date }}';
33+
const endDate = '${{ inputs.end_date }}';
34+
const expectedTitle = `[Week${weekNumber}] ${startDate} ~ ${endDate} 주차 문제`;
35+
36+
// 모든 이슈 중에서 같은 제목이 있는지 확인
37+
const { data: issues } = await github.rest.issues.listForRepo({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
state: 'all',
41+
labels: 'weekly-challenge'
42+
});
43+
44+
const duplicate = issues.find(issue => issue.title === expectedTitle);
45+
46+
if (duplicate) {
47+
console.log(`⚠️ Issue already exists: ${duplicate.html_url}`);
48+
core.setFailed(`중복된 이슈가 이미 존재합니다: ${duplicate.html_url}`);
49+
return 'skip';
50+
} else {
51+
console.log(`✅ No duplicate found. Proceeding to create issue.`);
52+
return 'create';
53+
}
54+
2655
- name: Create weekly issue
56+
if: steps.check.outputs.result == 'create'
2757
uses: actions/github-script@v7
2858
with:
2959
script: |

0 commit comments

Comments
 (0)