Conversation
Closed
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
github | 42e8778 | Commit Preview URL | Apr 04 2026, 07:02 PM |
Analyze solution files with OpenAI and post per-file review comments tagging the algorithm patterns used (Two Pointers, DP, BFS/DFS, etc.). - utils/openai.js: add generatePatternAnalysis() using gpt-4.1-nano with JSON response format - handlers/tag-patterns.js: new handler that filters solution files, replaces stale bot comments, and posts pattern analysis per file - handlers/webhooks.js: handle synchronize action and skip week check on re-push to avoid unnecessary latency - wrap per-file analysis in try/catch so one failure does not block other files Closes #4 Co-Authored-By: jylee2033 <jylee2033@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jylee2033
approved these changes
Apr 4, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
DaleStudy/leetcode-studyPR에 스터디원들이 솔루션을 제출하면, 각 파일에 어떤 알고리즘 패턴이 쓰였는지 자동으로 파악하기 어렵다. PR 파일 단위로 OpenAI가 패턴을 분석하고 review comment를 남겨서, 리뷰어들이 코드를 빠르게 파악할 수 있게 한다.Closes #4
변경 파일
utils/openai.jsgeneratePatternAnalysis)handlers/tag-patterns.jshandlers/webhooks.jshandlePullRequestEvent리팩토링Step 1.
utils/openai.js—generatePatternAnalysis()추가기존
generateCodeReview()와 동일한 패턴으로 신규 함수 추가.gpt-4.1-nano(기존과 동일)response_format: { type: "json_object" }사용해서 JSON 파싱 안정성 확보temperature: 0.3(결정적인 분석){ "patterns": ["Sliding Window", "Hash Map"], "description": "설명 텍스트" }감지 대상 16개 패턴:
Step 2.
handlers/tag-patterns.js— 신규 핸들러 생성2-1. 스킵 조건 확인
prData.draft === true→ skipprData.labels에maintenance포함 → skip2-2. PR 변경 파일 목록 조회 + 필터링
GET /repos/{owner}/{repo}/pulls/{pr_number}/files?per_page=100status가added또는modified{problem-name}/{username}.{extension}패턴 (정규식:/^[^/]+\/[^/]+\.[^.]+$/)2-3. 기존 Bot 패턴 태그 코멘트 삭제
comment.user.type === \"Bot\" && comment.body.includes(\"<!-- dalestudy-pattern-tag -->\")조건 만족하는 코멘트만 삭제2-4. 파일별 OpenAI 분석 + 코멘트 작성
file.raw_url로 파일 내용 가져오기 (20K 문자 초과 시 truncate)generatePatternAnalysis()호출POST /repos/{owner}/{repo}/pulls/{pr_number}/commentswithsubject_type: \"file\"→ 특정 라인이 아닌 파일 전체에 commentStep 3.
handlers/webhooks.js—handlePullRequestEvent()리팩토링3-1.
synchronize액션 추가기존
[\"opened\", \"reopened\"]→[\"opened\", \"reopened\", \"synchronize\"]3-2. Week check 최적화
opened/reopened: 기존대로 3초 대기 + week check + 패턴 태깅synchronize(재push): week check 스킵 (이미 설정됐을 가능성 높음) → 패턴 태깅만 실행3-3. 패턴 태깅 호출
OPENAI_API_KEY있을 때만 실행구현 중 반영한 안전장치
patterns배열 아니면 빈 배열,description문자열 아니면 빈 문자열재사용한 기존 함수
getGitHubHeaders(token)utils/github.jshasMaintenanceLabel(labels)utils/validation.jsgenerateGitHubAppToken(env)utils/github.js(webhooks.js에서 호출)검증 방법
synchronize이벤트 트리거