Create Weekly Issue #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Weekly Issue | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| week_number: | |
| description: '주차 번호 (예: 01, 02, 03)' | |
| required: true | |
| type: string | |
| start_date: | |
| description: '시작 날짜 (YYYY.MM.DD)' | |
| required: true | |
| type: string | |
| end_date: | |
| description: '종료 날짜 (YYYY.MM.DD)' | |
| required: true | |
| type: string | |
| jobs: | |
| create-issue: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Check for duplicate issue | |
| id: check | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const weekNumber = '${{ inputs.week_number }}'; | |
| const startDate = '${{ inputs.start_date }}'; | |
| const endDate = '${{ inputs.end_date }}'; | |
| const expectedTitle = `[Week${weekNumber}] ${startDate} ~ ${endDate} 주차 문제`; | |
| // 모든 이슈 중에서 같은 제목이 있는지 확인 | |
| const { data: issues } = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'all', | |
| labels: 'weekly-challenge' | |
| }); | |
| const duplicate = issues.find(issue => issue.title === expectedTitle); | |
| if (duplicate) { | |
| console.log(`⚠️ Issue already exists: ${duplicate.html_url}`); | |
| core.setFailed(`중복된 이슈가 이미 존재합니다: ${duplicate.html_url}`); | |
| core.setOutput('should_create', 'false'); | |
| } else { | |
| console.log(`✅ No duplicate found. Proceeding to create issue.`); | |
| core.setOutput('should_create', 'true'); | |
| } | |
| - name: Create weekly issue | |
| if: steps.check.outputs.should_create == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const weekNumber = '${{ inputs.week_number }}'; | |
| const startDate = '${{ inputs.start_date }}'; | |
| const endDate = '${{ inputs.end_date }}'; | |
| const issueBody = `## Week ${weekNumber} (${startDate} ~ ${endDate}) | |
| 이번 주 공통 문제입니다! 💪 | |
| ### 📝 문제 목록 | |
| #### 문제 1 | |
| - **플랫폼**: 백준 / 프로그래머스 / 리트코드 | |
| - **문제 번호**: | |
| - **문제 이름**: | |
| - **난이도**: | |
| - **링크**: | |
| #### 문제 2 | |
| - **플랫폼**: | |
| - **문제 번호**: | |
| - **문제 이름**: | |
| - **난이도**: | |
| - **링크**: | |
| #### 문제 3 | |
| - **플랫폼**: | |
| - **문제 번호**: | |
| - **문제 이름**: | |
| - **난이도**: | |
| - **링크**: | |
| --- | |
| ### ✅ 진행 상황 | |
| - [ ] @sukangpunch | |
| - [ ] @Hexeong | |
| - [ ] @whqtker | |
| - [ ] @JAEHEE25 | |
| - [ ] @Gyuhyeok99 | |
| --- | |
| ### 💡 참고사항 | |
| 문제 풀이는 \`weekly/week${weekNumber}/\` 디렉토리에 업로드해주세요! | |
| \`\`\`bash | |
| weekly/week${weekNumber}/ | |
| ├── BOJ_1234_문제명/ | |
| │ ├── gyuhyeok99.py | |
| │ └── member2.java | |
| └── PGS_5678_문제명/ | |
| └── member3.cpp | |
| \`\`\` | |
| `; | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: `[Week${weekNumber}] ${startDate} ~ ${endDate} 주차 문제`, | |
| body: issueBody, | |
| labels: ['weekly-challenge'] | |
| }); |