Skip to content

Commit 7655ac9

Browse files
authored
Merge pull request #11 from LiteObject/feature/refactor_code
Simplify message in InfoController's Get method
2 parents 9537a63 + d3c3d92 commit 7655ac9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/code-review.yml

+9-3
Original file line numberDiff line numberDiff 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
@@ -57,7 +63,7 @@ jobs:
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

src/MyWebApi/MyWebApi/Controllers/WeatherForecastController.cs

+1-1
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)