@@ -29,48 +29,41 @@ jobs:
2929 token=$(echo "$raw" | jq -r '.value')
3030 echo "TOKEN=$token" >> $GITHUB_ENV
3131
32- # 2. Checkout the PR head at the exact commit
33- - name : 🔄 Checkout PR head at exact commit
32+ - name : 🔄 Checkout PR HEAD at exact commit
3433 uses : actions/checkout@v3
3534 with :
3635 repository : ${{ github.event.pull_request.head.repo.full_name }}
3736 ref : ${{ github.event.pull_request.head.sha }}
3837 fetch-depth : 0
3938
40- # 3. Collect & inspect changed JSON files (fixed)
41- - name : 📁 Collect & inspect changed JSON files
42- id : prepare_json_files
39+ - name : 📁 Collect changed JSON files
4340 run : |
4441 echo "🔍 Finding changed JSON files..."
45- BASE_BRANCH=${{ github.event.pull_request.base.ref }}
46- echo "Base branch: $BASE_BRANCH"
42+ BASE=${{ github.event.pull_request.base.ref }}
4743
48- git fetch origin $BASE_BRANCH
49- echo "✅ Fetched origin/$BASE_BRANCH "
44+ git fetch origin $BASE
45+ echo "✅ Fetched origin/$BASE "
5046
51- all_changed=$(git diff --name-only origin/$BASE_BRANCH...HEAD)
52- echo "🔁 All changed files in PR:"
53- echo "$all_changed"
47+ echo "🔁 Git diff from origin/$BASE to HEAD:"
48+ git diff --name-only origin/$BASE...HEAD
49+
50+ mapfile -t files < <(git diff --name-only origin/$BASE...HEAD | grep '\.json$' || true)
5451
55- mapfile -t files < <(echo "$all_changed" | grep '\.json$' || true)
5652 echo "🧾 JSON files to process (${#files[@]}): ${files[*]:-<none>}"
5753
5854 json_array="["
5955 for file in "${files[@]}"; do
60- echo "📄 Checking $file"
61- if [ -f "$file" ] && jq -e . "$file" > /dev/null; then
56+ if [ -f "$file" ]; then
6257 content=$(jq -c . < "$file")
6358 json_array+="{\"filename\":\"$file\",\"content\":$content},"
64- else
65- echo "⚠️ Skipping invalid/missing JSON: $file"
6659 fi
6760 done
6861 json_array="${json_array%,}]"
69- echo "✅ Final JSON array:"
70- echo "$json_array"
7162 echo "$json_array" > files_payload.json
7263 echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
73- echo "✅ Payload size: $(wc -c < files_payload.json) bytes"
64+ echo "✅ Final JSON array:"
65+ cat files_payload.json
66+
7467
7568
7669 # 3. Send a simple GET request to "/"
0 commit comments