File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/MyWebApi/MyWebApi/Controllers Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,18 @@ jobs:
3434 echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
3535 git diff origin/${{ github.base_ref }}...${{ github.head_ref }} > changes.diff
3636
37+ # Step 4: Sanitize the diff file
38+ - name : Sanitize Diff
39+ run : |
40+ # Remove metadata lines and retain only actual code changes (+/-)
41+ grep -E '^(\+|-)' changes.diff | sed 's/^+/Added: /; s/^-/Removed: /' > sanitized_diff.txt
42+
3743 # Step 4: Upload the diff file as an artifact (optional)
3844 - name : Upload Diff as Artifact
3945 uses : actions/upload-artifact@v4
4046 with :
41- name : pr-diff
42- path : changes.diff
47+ name : sanitized- pr-diff
48+ path : sanitized_diff.txt
4349
4450 # Step 5: Install Ollama
4551 - name : Install Ollama
5763 - name : Prepare Prompt
5864 id : prepare-prompt
5965 run : |
60- DIFF=$(cat changes.diff )
66+ DIFF=$(cat sanitized_diff.txt )
6167 PROMPT=$(echo "Please review the following code changes and provide feedback:\n\n$DIFF\n\nFeedback:" | sed 's/"/\\"/g')
6268 echo "prompt=$PROMPT" >> $GITHUB_ENV
6369
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public InfoController(ILogger<InfoController> logger)
1717 public IActionResult Get ( )
1818 {
1919 // Log a message at the Information level
20- var message = "Hello World from InfoController. This is a sample message. " ;
20+ var message = "Hello World from InfoController." ;
2121 _logger . LogInformation ( message ) ;
2222 return Ok ( message ) ;
2323 }
You can’t perform that action at this time.
0 commit comments