@@ -21,16 +21,23 @@ jobs:
21
21
# Checks out the code from the pull request's head branch.
22
22
ref : ${{ github.event.pull_request.head.ref }}
23
23
fetch-depth : 0
24
+
25
+ # Fetches the base branch (e.g., main) from the remote repository
26
+ - name : Fetch base branch
27
+ run : |
28
+ git fetch origin ${{ github.base_ref }}
24
29
25
- - name : Fetch Pull Request Branch
26
- run : git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch
30
+ # - name: Fetch Pull Request Branch
31
+ # run: git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch
27
32
28
33
- name : Generate Diff
34
+ id : generate-diff
29
35
run : |
30
- set -e
31
- git diff $GITHUB_BASE_REF pr-branch > change.diff
32
- echo "Diff generated successfully."
33
- echo "Diff content:" $(cat change.diff)
36
+ echo "Generating diff between ${{ github.base_ref }} and ${{ github.head_ref }}"
37
+ DIFF=$(git diff origin/${{ github.base_ref }}...${{ github.head_ref }})
38
+ echo "diff_output<<EOF" >> $GITHUB_ENV
39
+ echo "$DIFF" >> $GITHUB_ENV
40
+ echo "EOF" >> $GITHUB_ENV
34
41
35
42
- name : Check Diff Size
36
43
id : check_diff_size
43
50
exit 0
44
51
fi
45
52
53
+ # Step 4: Output the diff (optional)
54
+ - name : Print diff
55
+ run : |
56
+ echo "Diff Output:"
57
+ echo "${{ env.diff_output }}"
58
+
59
+ # Step 5: Save the diff to a file (optional)
60
+ - name : Save diff to file
61
+ run : |
62
+ echo "${{ env.diff_output }}" > changes.diff
63
+
46
64
# - name: Install Ollama CLI
47
65
# run: |
48
66
# curl -fsSL https://ollama.com/install.sh | sh
0 commit comments