DaleStudy 조직의 자동화 작업을 처리하는 GitHub App (https://github.com/apps/dalestudy)
DaleStudy 조직의 여러 repository에서 반복적인 작업들을 자동화하는 확장 가능한 플랫폼입니다.
Fork PR에서도 작동하도록 GitHub Projects v2의 Week 필드를 조회하고, Week 설정이 누락된 PR에 자동으로 경고 댓글을 작성합니다.
트리거 방식:
- 실시간: GitHub Organization Webhook (Week 설정 변경 즉시 반응)
- 수동: REST API 직접 호출
대상: https://github.com/DaleStudy/leetcode-study
설정 가이드: AGENTS.md의 "GitHub Organization Webhook 설정" 섹션 참고
단일 Worker에 여러 엔드포인트를 추가하여 다양한 자동화 요구사항을 처리할 예정입니다.
- https://dash.cloudflare.com 회원가입
- Workers 섹션으로 이동
npm install -g wrangler
wrangler loginGitHub App의 credentials를 Worker secrets에 저장:
cd cloudflare-worker
# APP_ID 설정
wrangler secret put APP_ID
# 프롬프트에서 GitHub App ID 입력
# PRIVATE_KEY 설정
wrangler secret put PRIVATE_KEY
# 프롬프트에서 GitHub App Private Key 전체 내용 입력
# (-----BEGIN RSA PRIVATE KEY----- 부터 -----END RSA PRIVATE KEY----- 까지)wrangler deploy배포 완료 후 Custom Domain을 통해 접근 가능합니다:
https://github.dalestudy.com
Base URL: https://github.dalestudy.com
모든 Open PR에서 Week 설정을 검사하고 자동으로 댓글 작성/삭제
Request:
요청 바디에서 repo_owner를 생략하면 자동으로 DaleStudy가 사용됩니다.
{
"repo_name": "leetcode-study"
}Response:
{
"success": true,
"total_prs": 3,
"checked": 3,
"commented": 1,
"deleted": 1,
"results": [
{ "pr": 1970, "week": null, "commented": true },
{ "pr": 1969, "week": "Week 8", "commented": false, "deleted": true }
]
}열려있는 답안 제출 PR을 일괄 승인합니다. excludes 배열을 사용해 특정 PR 번호를 제외할 수 있습니다. 이미 승인되었거나 Draft/maintenance 라벨이 붙은 PR은 자동으로 스킵됩니다.
Request:
{ "repo_name": "leetcode-study", "excludes": [1972] }Response:
{
"success": true,
"action": "approve",
"repo": "DaleStudy/leetcode-study",
"total_open_prs": 5,
"processed": 2,
"approved": 2,
"skipped": 0,
"results": [
{ "pr": 1970, "title": "week8 solutions", "approved": true },
{ "pr": 1971, "title": "week8 extras", "approved": true }
]
}열려있는 PR을 일괄 병합합니다. 기본 병합 방식은 merge이며, merge_method로 merge | squash | rebase 중 선택할 수 있습니다. excludes 배열로 특정 PR을 제외할 수 있습니다. 최소 1개의 승인 리뷰가 없거나 Draft/maintenance 라벨이 붙은 PR은 스킵되며, GitHub에서 mergeable_state === "clean"인 PR만 병합됩니다(behind, dirty, unknown 등은 스킵). unknown/behind 상태는 최대 1초 후 한 차례 재확인합니다.
Request:
{
"repo_name": "leetcode-study",
"excludes": [1972],
"merge_method": "squash"
}Response:
{
"success": true,
"action": "merge",
"repo": "DaleStudy/leetcode-study",
"merge_method": "squash",
"total_open_prs": 5,
"processed": 2,
"merged": 2,
"skipped": 0,
"results": [
{ "pr": 1970, "title": "week8 solutions", "merged": true, "sha": "abc123" },
{ "pr": 1971, "title": "week8 extras", "merged": true, "sha": "def456" }
]
}# 개발 서버 시작
wrangler dev
# 로컬 테스트 (별도 터미널)
curl -X POST http://localhost:8787/check-weeks \
-H "Content-Type: application/json" \
-d '{"repo_owner": "DaleStudy", "repo_name": "leetcode-study"}'curl -X POST https://github.dalestudy.com/check-weeks \
-H "Content-Type: application/json" \
-d '{"repo_owner": "DaleStudy", "repo_name": "leetcode-study"}'wrangler tail- DaleStudy organization만 허용
- CORS 헤더 설정 (모든 origin 허용)
- GitHub App credentials는 Worker secrets에 안전하게 저장
- Rate limiting은 Cloudflare에서 자동 처리
Cloudflare Workers 무료 티어:
- 100,000 requests/day
- 10ms CPU time per request
리트코드 스터디 PR 수준이면 무료 티어로 충분합니다.
새로운 자동화 기능을 추가하려면:
index.js에 새 엔드포인트 라우팅 추가- 핸들러 함수 구현 (기존
handleCheckAllPrs참고) - GitHub App 권한 확인 및 필요시 추가
- 문서(AGENTS.md, README.md) 업데이트
- 로컬 테스트 후 배포 (
wrangler deploy)
자세한 가이드는 AGENTS.md를 참고하세요.
GitHub App credentials 확인:
wrangler secret listAPP_ID와 PRIVATE_KEY가 모두 설정되어 있어야 합니다.
DaleStudy organization이 아닌 경우 차단됩니다.
- AGENTS.md: AI 에이전트를 위한 상세 가이드 (개발자도 필독!)
- DEPLOYMENT.md: 처음부터 배포하는 전체 가이드
- GitHub App: https://github.com/organizations/DaleStudy/settings/apps/dalestudy