-
Notifications
You must be signed in to change notification settings - Fork 2
풀이 추가/수정 커밋시 기존 분석은 유지하고 추가/수정 파일에 대해서만 분석하도록 변경 #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
parkhojeong
wants to merge
4
commits into
DaleStudy:main
Choose a base branch
from
parkhojeong:260729-improve-tag-patterns-48
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c54e182
풀이 추가/수정 커밋시 기존 분석은 유지하고 추가/수정 파일에 대해서만 분석하도록 변경
parkhojeong 31ac045
webhooks.js resolveChangedFilenames 반환 패턴 단순화
parkhojeong f99b314
분석 대상 파일이 문자열 길이 제한을 초과해 잘린 경우에만 생략 문구 표시
parkhojeong 0a3e5d8
파일 내용의 백틱과 충돌하지 않도록 코드 fence 길이 조정
parkhojeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,6 +235,25 @@ async function getChangedFilenames(repoOwner, repoName, baseSha, headSha, appTok | |
| return (data.files || []).map((f) => f.filename); | ||
| } | ||
|
|
||
| async function resolveChangedFilenames(payload, repoOwner, repoName, appToken) { | ||
| if (payload.action !== "synchronize" || !payload.before || !payload.after) { | ||
| return null; | ||
| } | ||
|
|
||
| try { | ||
| return await getChangedFilenames( | ||
| repoOwner, | ||
| repoName, | ||
| payload.before, | ||
| payload.after, | ||
| appToken | ||
| ); | ||
| } catch (error) { | ||
| console.error(`[resolveChangedFilenames] failed: ${error.message}`); | ||
| return null; | ||
| } | ||
| } | ||
|
Comment on lines
+238
to
+255
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 일반 push는 |
||
|
|
||
| /** | ||
| * Pull Request 이벤트 처리 | ||
| * - opened/reopened: Week 설정 체크 + 알고리즘 패턴 태깅 (전체 파일) | ||
|
|
@@ -288,6 +307,13 @@ async function handlePullRequestEvent(payload, env, ctx) { | |
| if (env.OPENAI_API_KEY && env.INTERNAL_SECRET && env.WORKER_URL) { | ||
| const baseUrl = env.WORKER_URL; | ||
|
|
||
| const changedFilenames = await resolveChangedFilenames( | ||
| payload, | ||
| repoOwner, | ||
| repoName, | ||
| appToken | ||
| ); | ||
|
|
||
| const dispatchHeaders = { | ||
| "Content-Type": "application/json", | ||
| "X-Internal-Secret": env.INTERNAL_SECRET, | ||
|
|
@@ -304,6 +330,7 @@ async function handlePullRequestEvent(payload, env, ctx) { | |
| ...commonPayload, | ||
| headSha: pr.head.sha, | ||
| prData: pr, | ||
| changedFilenames, | ||
| }), | ||
| }).catch((err) => | ||
| console.error(`[dispatch] tagPatterns failed: ${err.message}`) | ||
|
|
@@ -329,22 +356,14 @@ async function handlePullRequestEvent(payload, env, ctx) { | |
| // INTERNAL_SECRET/WORKER_URL 미설정 시 기존 방식으로 폴백 (동일 invocation에서 순차 실행) | ||
| console.warn("[handlePullRequestEvent] INTERNAL_SECRET or WORKER_URL not set, running handlers in-process"); | ||
|
|
||
| try { | ||
| // synchronize일 때만 변경 파일 목록 추출 (최적화: #7) | ||
| let changedFilenames = null; | ||
| if (action === "synchronize" && payload.before && payload.after) { | ||
| changedFilenames = await getChangedFilenames( | ||
| repoOwner, | ||
| repoName, | ||
| payload.before, | ||
| payload.after, | ||
| appToken | ||
| ); | ||
| console.log( | ||
| `[handlePullRequestEvent] synchronize: ${changedFilenames?.length ?? "fallback(all)"} files changed between ${payload.before.slice(0, 7)}...${payload.after.slice(0, 7)}` | ||
| ); | ||
| } | ||
| const changedFilenames = await resolveChangedFilenames( | ||
| payload, | ||
| repoOwner, | ||
| repoName, | ||
| appToken | ||
| ); | ||
|
|
||
| try { | ||
| await tagPatterns( | ||
| repoOwner, | ||
| repoName, | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
풀이 파일의 주석이나 docstring에
```이 포함되면 혹시details블록이 깨지지는 않겠죠?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```포함되면 깨져서 파일 내용의 백틱을 확인해서 긴 fense를 사용하도록 수정해주었습니다. 0a3e5d8There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 조치 감사합니다. 그런데 공유해주신 커밋은 리베이스 과정에서 유실된 것 같습니다. (개인적으로 커밋 링크 공유는 의도한 것과 같은 효과가 나기는 힘들 것 같더라고요. 🙂)