-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add processSavePullRequest function and integrate it into the savePullRequestTask #869
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Updates to Preview Branch (save-function-1) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
eecb9fb
to
796b003
Compare
796b003
to
0be2f94
Compare
0be2f94
to
63cd83e
Compare
CI Feedback 🧐(Feedback updated until commit 21fe4c6)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
63cd83e
to
40652b6
Compare
40652b6
to
d991103
Compare
d991103
to
fe52406
Compare
fe52406
to
21fe4c6
Compare
21fe4c6
to
a9071cb
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
Thanks!
} | ||
|
||
const data = JSON.parse(payload) as GitHubWebhookPayload | ||
validateConfig() |
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.
This line is unnecessary, because Because it is done at server startup.
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.
oh, good!
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.
I'll fix that in this week 🙏
@@ -6,6 +6,7 @@ import { | |||
import type { GitHubWebhookPayload } from '@/types/github' | |||
import { prisma } from '@liam-hq/db' | |||
|
|||
// deprecated |
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.
👍🏻
owner: payload.owner, | ||
name: payload.name, | ||
repositoryId: payload.repositoryId, | ||
} as SavePullRequestPayload) |
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.
Please do not use as
if possible. Was it necessary?
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.
Unnecessary. Applying #869 (comment) will solve that. 🙏
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.
Regarding the conflict in this pull request and the lengthy Vercel deployment, I'll address these issues in a separate PR. 🙏
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.
Looks good, Thank you 👍🏻
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.
I've reviewed the code and confirmed that it aligns with the intent of the PR. If there are no specific areas you'd like me to pay extra attention to, it's good to go! LGTM! 🚀
try { | ||
const result = await processSavePullRequest({ | ||
prNumber: payload.pullRequestNumber, | ||
owner: payload.owner, | ||
name: payload.name, | ||
repositoryId: payload.repositoryId, | ||
} as SavePullRequestPayload) | ||
logger.info('Successfully saved PR to database:', { prId: result.prId }) | ||
|
||
// Trigger the next task in the chain - generate review | ||
await generateReviewTask.trigger({ | ||
...payload, | ||
projectId: undefined, | ||
schemaChanges: result.schemaChanges, | ||
} as GenerateReviewPayload) | ||
|
||
return result | ||
} catch (error) { | ||
logger.error('Error in savePullRequest task:', { error }) | ||
throw error | ||
} |
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.
📝
Save the pull request details to the database, then trigger the review generation.
switch (action) { | ||
case 'opened': | ||
case 'synchronize': | ||
case 'reopened': { | ||
// Queue the savePullRequest task | ||
await savePullRequestTask.trigger({ | ||
pullRequestNumber: pullRequest.number, | ||
projectId: undefined, | ||
owner: data.repository.owner.login, | ||
name: data.repository.name, | ||
repositoryId: data.repository.id, | ||
}) |
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.
📝
Trigger savePullRequestTask when a pull request is opened, synchronized, or reopened.
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.
📝
Check if the corresponding repository exists in the database, retrieve the PR's modified files, analyze the changed files, save them to the database, and return the PR data for the next process.
Issue
Why is this change needed?
What would you like reviewers to focus on?
Testing Verification
What was done
🤖 Generated by PR Agent at a9071cb
processSavePullRequest
function for PR data handling.savePullRequestTask
with webhook and database operations.Detailed Changes
6 files
Refactor webhook handling and integrate PR save task
Extend file change handling with detailed statuses
Add `processSavePullRequest` function for PR data processing
Integrate `processSavePullRequest` into `savePullRequestTask`
Update types to support optional projectId
Enhance `FileChange` type with detailed statuses and patch
2 files
Mark `handlePullRequest` as deprecated
Document updated PR save and review workflow
Additional Notes