Skip to content

Display if diff truncated - #213

Merged
sungeunbae merged 2 commits into
masterfrom
ollama-pr-review
Jun 25, 2026
Merged

Display if diff truncated#213
sungeunbae merged 2 commits into
masterfrom
ollama-pr-review

Conversation

@sungeunbae

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 24, 2026 23:35
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@github-actions

Copy link
Copy Markdown

📁 .github/workflows/pr-review.yml (deepseek-v4-flash:cloud)

💻 Code: ````
// Clean up

  •        if (fs.existsSync('model.txt')) {
    
  •          fs.unlinkSync('model.txt');
    
  •        const filesToClean = ['review.txt', 'model.txt', 'diff_size.txt', 'was_truncated.txt'];
    
  •        for (const file of filesToClean) {
    
  •          if (fs.existsSync(file)) {
    
  •            fs.unlinkSync(file);
    
  •          }
           }
    

**⚠️ Problem:** The original closing brace `}` (from the removed `if` block) remains in the code after the new `for` loop is added. This results in an extra closing brace, causing a syntax error in the JavaScript script.

**✅ Fix:** Remove the leftover closing brace that was originally part of the `if` statement. The corrected cleanup block should be:
```
             // Clean up
            const filesToClean = ['review.txt', 'model.txt', 'diff_size.txt', 'was_truncated.txt'];
            for (const file of filesToClean) {
              if (fs.existsSync(file)) {
                fs.unlinkSync(file);
              }
            }
```

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the AI PR review GitHub Actions workflow to surface whether the pull request diff was truncated (and its size) in the bot’s summary comment, improving transparency when large diffs are reviewed.

Changes:

  • Persist a was_truncated.txt flag during diff truncation logic.
  • Read and display truncation metadata (diff_size.txt, was_truncated.txt) in the final PR summary comment.
  • Consolidate cleanup into a small file-deletion loop.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +64
echo "true" > was_truncated.txt
mv pr.diff.truncated pr.diff
else
echo "✅ Diff size OK"
echo "false" > was_truncated.txt
Comment on lines 371 to 375
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## 🤖 AI Code Review (${model})\n\nFound **${reviewComments.length}** issues. See inline comments for details.`
body: `## 🤖 AI Code Review (${model})\n\nFound **${reviewComments.length}** issues.\n\n**Diff size:** ${diffSize} bytes\n**Truncated:** ${truncated}\n\nSee inline comments for details.`
});
Comment on lines +380 to +384
const filesToClean = ['review.txt', 'model.txt', 'diff_size.txt', 'was_truncated.txt'];
for (const file of filesToClean) {
if (fs.existsSync(file)) {
fs.unlinkSync(file);
}
@github-actions

Copy link
Copy Markdown

🤖 AI Code Review (deepseek-v4-flash:cloud)

✅ No issues found. The code looks good.

@sungeunbae
sungeunbae merged commit f08fd91 into master Jun 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants