@@ -3,10 +3,6 @@ name: Extension AI Analysis
3
3
on :
4
4
pull_request_target :
5
5
types : [opened, synchronize, reopened, ready_for_review]
6
- push :
7
- branches :
8
- - main
9
- - 5.*
10
6
11
7
concurrency :
12
8
group : ${{ github.workflow }}-${{ github.ref }}
@@ -21,11 +17,15 @@ jobs:
21
17
pull-requests : write
22
18
timeout-minutes : 30
23
19
steps :
24
- - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20
+ - name : Checkout the fork PR code
21
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25
22
with :
23
+ repository : ${{ github.event.pull_request.head.repo.full_name }}
24
+ ref : ${{ github.event.pull_request.head.ref }}
26
25
fetch-depth : 0 # Fetch full history for git diff
27
26
28
- - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
27
+ - name : Setup Python
28
+ uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
29
29
with :
30
30
python-version : " 3.12"
31
31
cache : " pip"
@@ -47,17 +47,13 @@ jobs:
47
47
48
48
- name : Get changed files
49
49
run : |
50
- echo "Event: ${{ github.event_name }}"
51
50
mkdir -p /tmp/ai-analysis-reports
52
- if [ "${{ github.event_name }}" = "pull_request" ]; then
53
- # For pull requests, compare against the base branch
54
- BASE_REF="${{ github.event.pull_request.base.ref }}"
55
- echo "Base ref: $BASE_REF"
56
- git diff --name-only "origin/$BASE_REF"...HEAD > /tmp/ai-analysis-reports/changed_files.txt 2>/dev/null
57
- else
58
- # For pushes, compare against the previous commit or get all JSON files if it's the first commit
59
- git diff --name-only HEAD~1 HEAD > /tmp/ai-analysis-reports/changed_files.txt 2>/dev/null
60
- fi
51
+ BASE_REF="${{ github.event.pull_request.base.ref }}"
52
+ git fetch origin $BASE_REF
53
+ echo "Base ref: $BASE_REF"
54
+ # List only Added (A) or Modified (M) JSON files
55
+ git diff --name-only --diff-filter=AM "origin/$BASE_REF"...HEAD \
56
+ | grep '\.json$' > /tmp/ai-analysis-reports/changed_files.txt 2>/dev/null
61
57
echo "Changed JSON files:"
62
58
cat /tmp/ai-analysis-reports/changed_files.txt
63
59
0 commit comments