Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ jobs:
echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
git diff origin/${{ github.base_ref }}...${{ github.head_ref }} > changes.diff

# Step 4: Sanitize the diff file
- name: Sanitize Diff
run: |
# Remove metadata lines and retain only actual code changes (+/-)
grep -E '^(\+|-)' changes.diff | sed 's/^+/Added: /; s/^-/Removed: /' > sanitized_diff.txt

# Step 4: Upload the diff file as an artifact (optional)
- name: Upload Diff as Artifact
uses: actions/upload-artifact@v4
with:
name: pr-diff
path: changes.diff
name: sanitized-pr-diff
path: sanitized_diff.txt

# Step 5: Install Ollama
- name: Install Ollama
Expand All @@ -57,7 +63,7 @@ jobs:
- name: Prepare Prompt
id: prepare-prompt
run: |
DIFF=$(cat changes.diff)
DIFF=$(cat sanitized_diff.txt)
PROMPT=$(echo "Please review the following code changes and provide feedback:\n\n$DIFF\n\nFeedback:" | sed 's/"/\\"/g')
echo "prompt=$PROMPT" >> $GITHUB_ENV

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public InfoController(ILogger<InfoController> logger)
public IActionResult Get()
{
// Log a message at the Information level
var message = "Hello World from InfoController. This is a sample message.";
var message = "Hello World from InfoController.";
_logger.LogInformation(message);
return Ok(message);
}
Expand Down