@@ -68,9 +68,9 @@ export async function newFeature(request, env) {
6868}
6969
7070// index.js에 라우팅 추가
71- import { newFeature } from ' ./handlers/new-feature.js' ;
71+ import { newFeature } from " ./handlers/new-feature.js" ;
7272
73- if (url .pathname === ' /new-feature' ) {
73+ if (url .pathname === " /new-feature" ) {
7474 return newFeature (request, env);
7575}
7676```
@@ -151,9 +151,10 @@ GitHub Organization webhook 수신용 엔드포인트
151151
152152** Request:**
153153
154+ ` repo_owner ` 생략 시 기본값으로 ` DaleStudy ` 가 사용됩니다.
155+
154156``` json
155157{
156- "repo_owner" : " DaleStudy" ,
157158 "repo_name" : " leetcode-study"
158159}
159160```
@@ -174,6 +175,67 @@ GitHub Organization webhook 수신용 엔드포인트
174175}
175176```
176177
178+ #### ` POST /approve-prs `
179+
180+ 열려있는 답안 제출 PR을 일괄 승인합니다. ` excludes ` 배열로 특정 PR을 제외합니다. 이미 승인된 PR, ` maintenance ` 라벨, Draft 상태의 PR은 자동으로 스킵됩니다.
181+
182+ ** Request:**
183+
184+ ``` json
185+ { "repo_name" : " leetcode-study" , "excludes" : [1972 ] }
186+ ```
187+
188+ ** Response:**
189+
190+ ``` json
191+ {
192+ "success" : true ,
193+ "action" : " approve" ,
194+ "repo" : " DaleStudy/leetcode-study" ,
195+ "total_open_prs" : 5 ,
196+ "processed" : 2 ,
197+ "approved" : 2 ,
198+ "skipped" : 0 ,
199+ "results" : [
200+ { "pr" : 1970 , "title" : " week8 solutions" , "approved" : true },
201+ { "pr" : 1971 , "title" : " week8 extras" , "approved" : true }
202+ ]
203+ }
204+ ```
205+
206+ #### ` POST /merge-prs `
207+
208+ 열려있는 PR을 일괄 병합합니다. 기본 병합 방식은 ` merge ` 이며 ` merge_method ` 값으로 ` merge | squash | rebase ` 중 선택할 수 있습니다. ` excludes ` 로 특정 PR을 제외할 수 있습니다. 승인 리뷰가 없거나 ` maintenance ` 라벨이 붙은 PR, Draft PR, GitHub ` mergeable_state !== "clean" ` PR은 스킵되며 ` unknown ` /` behind ` 상태는 최대 1초 후 한 번 더 확인합니다.
209+
210+ ** Request:**
211+
212+ ``` json
213+ {
214+ "repo_name" : " leetcode-study" ,
215+ "merge_method" : " squash" ,
216+ "excludes" : [1972 ]
217+ }
218+ ```
219+
220+ ** Response:**
221+
222+ ``` json
223+ {
224+ "success" : true ,
225+ "action" : " merge" ,
226+ "repo" : " DaleStudy/leetcode-study" ,
227+ "merge_method" : " squash" ,
228+ "total_open_prs" : 5 ,
229+ "processed" : 2 ,
230+ "merged" : 2 ,
231+ "skipped" : 0 ,
232+ "results" : [
233+ { "pr" : 1970 , "title" : " week8 solutions" , "merged" : true , "sha" : " abc123" },
234+ { "pr" : 1971 , "title" : " week8 extras" , "merged" : true , "sha" : " def456" }
235+ ]
236+ }
237+ ```
238+
177239### 3. 워크플로우
178240
1792411 . Open PR 목록 조회 (GitHub REST API)
@@ -192,7 +254,7 @@ GitHub Organization webhook 수신용 엔드포인트
192254
193255- ` contents: read ` : PR 정보 조회
194256- ` issues: write ` : 댓글 작성 및 삭제
195- - ` pull_requests: read ` : PR 목록 및 상태 조회
257+ - ` pull_requests: read & write ` : PR 목록/ 상태 조회, 리뷰 생성, 병합 수행
196258- ` organization_projects: read ` : Projects v2의 Week 필드 접근 (GraphQL API)
197259
198260### Secrets 관리
@@ -245,13 +307,15 @@ https://github.com/settings/apps/dalestudy
245307### 3. Permissions & events 탭 - 권한 설정
246308
247309** Repository permissions:**
310+
248311- ** Contents** : Read
249312- ** Issues** : Read & write (issue_comment 이벤트용)
250313- ** Metadata** : Read
251314- ** Pull requests** : Read & write
252315- ** Projects** : Read & write (Projects V2)
253316
254317** Subscribe to events:**
318+
255319- ☑️ ** Issue comments** (` issue_comment ` - AI 코드 리뷰)
256320- ☑️ ** Projects v2 item** (` projects_v2_item ` - Week 체크)
257321- ☑️ ** Pull requests** (` pull_request ` - Week 체크)
@@ -269,6 +333,7 @@ wrangler secret put WEBHOOK_SECRET
269333### 5. GitHub App 설치
270334
271335저장소에 App이 설치되어 있는지 확인:
336+
272337```
273338https://github.com/apps/dalestudy/installations
274339```
0 commit comments