Skip to content

Commit 9c36787

Browse files
committed
Update workflow name to reflect AI usage and adjust diff generation command for clarity
1 parent 73655a1 commit 9c36787

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

.github/workflows/code-review.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR Code Review with LLM
1+
name: PR Code Review with AI
22

33
# Trigger the workflow when a pull request is opened or updated
44
on:
@@ -8,40 +8,37 @@ on:
88

99
jobs:
1010
code-review:
11+
name: Review Changes with AI
1112
runs-on: ubuntu-latest
1213
permissions:
13-
issues: write
14+
issues: write # Allows the workflow to write comments on issues and pull requests
15+
pull-requests: write # Allows the workflow to write comments on pull requests
1416
env:
1517
MODEL_NAME: "llama3.2:latest"
16-
steps:
17-
# Step 1: Checkout the repository code
18+
steps:
1819
- name: Checkout Repository
1920
uses: actions/checkout@v4
2021
with:
21-
# Checks out the code from the pull request's head branch.
22-
ref: ${{ github.event.pull_request.head.ref }}
22+
# Checks out the code from the pull request's head branch, the feature branch with changes.
23+
# ref: ${{ github.event.pull_request.head.ref }}
2324
fetch-depth: 0
2425

25-
# Step 2: Fetch the base branch (e.g., main) from the remote repository
26-
- name: Fetch Base Branch
27-
run: |
28-
git fetch origin ${{ github.base_ref }}
29-
30-
# Step 3: Generate the diff between the base branch and the PR branch
26+
# - name: Fetch Base Branch
27+
# run: |
28+
# git fetch origin ${{ github.base_ref }}
29+
3130
- name: Generate Diff
3231
id: generate-diff
3332
run: |
3433
echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
35-
git diff --unified=5 origin/${{ github.base_ref }}...${{ github.head_ref }} > changes.diff
34+
# git diff --unified=5 origin/${{ github.base_ref }}...${{ github.head_ref }} > changes.diff
35+
git diff --unified=0 origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.ref }} > changes.diff
3636
37-
# Step 4: Sanitize the diff file
3837
- name: Sanitize Diff
3938
run: |
4039
# Remove metadata lines and retain only actual code changes (+/-)
4140
grep -E '^(\+|-)' changes.diff | sed 's/^+/Added: /; s/^-/Removed: /' > sanitized_diff.txt
42-
43-
44-
# Step 5: Upload the diff file as an artifact (optional)
41+
4542
- name: Upload Diff as Artifact
4643
uses: actions/upload-artifact@v4
4744
with:

src/MyWebApi/MyWebApi/Controllers/WeatherForecastController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public InfoController(ILogger<InfoController> logger)
1616
[HttpGet(Name = "Get")]
1717
public IActionResult Get()
1818
{
19+
var hello = "Hello";
1920
// Log a message at the Information level
2021
var message = "Hello World from InfoController. This is a sample message.";
2122
_logger.LogInformation(message);

0 commit comments

Comments
 (0)