File tree 2 files changed +10
-4
lines changed
src/MyWebApi/MyWebApi/Controllers
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,18 @@ jobs:
34
34
echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
35
35
git diff origin/${{ github.base_ref }}...${{ github.head_ref }} > changes.diff
36
36
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
+
37
43
# Step 4: Upload the diff file as an artifact (optional)
38
44
- name : Upload Diff as Artifact
39
45
uses : actions/upload-artifact@v4
40
46
with :
41
- name : pr-diff
42
- path : changes.diff
47
+ name : sanitized- pr-diff
48
+ path : sanitized_diff.txt
43
49
44
50
# Step 5: Install Ollama
45
51
- name : Install Ollama
57
63
- name : Prepare Prompt
58
64
id : prepare-prompt
59
65
run : |
60
- DIFF=$(cat changes.diff )
66
+ DIFF=$(cat sanitized_diff.txt )
61
67
PROMPT=$(echo "Please review the following code changes and provide feedback:\n\n$DIFF\n\nFeedback:" | sed 's/"/\\"/g')
62
68
echo "prompt=$PROMPT" >> $GITHUB_ENV
63
69
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public InfoController(ILogger<InfoController> logger)
17
17
public IActionResult Get ( )
18
18
{
19
19
// 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." ;
21
21
_logger . LogInformation ( message ) ;
22
22
return Ok ( message ) ;
23
23
}
You can’t perform that action at this time.
0 commit comments