Replies: 3 comments
-
|
To prevent reviewing already reviewed files in your Dr. GitHub codebase, you can implement a mechanism to track which files have already been reviewed and check if they have been modified in the new commit before running the review process again. Here’s a step-by-step approach you can use:
You need a way to store the list of files that have already been reviewed. This can be done in the following ways:
Whenever a new commit is pushed to a pull request, you should identify the files that have been modified in the commit. GitHub provides an API to fetch the files changed in a commit or a PR (via GET /repos/:owner/:repo/pulls/:pull_number/files).
When new commits are made, compare the list of modified files with the files that have already been reviewed:
Here’s a basic implementation flow:
Assuming you have a way to track reviewed files (either in a database or memory), here’s how you can modify your logic: // Assuming reviewedFiles is an array or Set of previously reviewed file paths // Function to get changed files in a commit or PR // Function to run review only on new or modified files for (const file of changedFiles) { } // Review function (simplified for example) // Example usage when a new commit is pushed
If you’re using GitHub’s PR and commit events to trigger your review process, the integration might look like this:
By implementing a system that tracks reviewed files and only processes new or modified files, you can greatly reduce the load on your chatbot review system and avoid redundant processing. This ensures that your bot is only used for the parts of the code that are truly new or have been updated. |
Beta Was this translation helpful? Give feedback.
-
|
Solution: store the last reviewed commit hash |
Beta Was this translation helpful? Give feedback.
-
|
moved to notion |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Prevent reviewing already reviewed files. Right now, we review all changed files when a new commit is there while the already reviewed files haven't been changed in the commit
Beta Was this translation helpful? Give feedback.
All reactions