4747
4848
4949
50-
50+
5151 # 4. Collect & inspect changed JSON files
5252 - name : 📁 Collect & inspect changed JSON files
5353 id : prepare_json_files
@@ -58,12 +58,12 @@ jobs:
5858 echo "Base branch: $BASE_BRANCH"
5959 echo "Head SHA: $HEAD_SHA"
6060
61- # Checkout PR head (already done), now fetch & create local base branch
62- git fetch origin $BASE_BRANCH:$BASE_BRANCH
63- echo "✅ Fetched base branch locally as ' $BASE_BRANCH' "
61+ # Fetch the base branch into FETCH_HEAD
62+ git fetch origin $BASE_BRANCH
63+ echo "✅ Fetched origin/ $BASE_BRANCH to FETCH_HEAD "
6464
65- # List all changed files between base and head
66- all_changed=$(git diff --name-only $BASE_BRANCH $HEAD_SHA)
65+ # List changed files between FETCH_HEAD ( base) and HEAD_SHA
66+ all_changed=$(git diff --name-only FETCH_HEAD $HEAD_SHA)
6767 echo "🔁 All changed files:"
6868 echo "$all_changed"
6969
@@ -75,13 +75,14 @@ jobs:
7575 json_array="["
7676 for file in "${files[@]}"; do
7777 echo "📄 Checking file: $file"
78- if [ -f "$file" ] && jq -e . "$file" > /dev/null 2>&1 ; then
78+ if [ -f "$file" ] && jq -e . "$file" > /dev/null; then
7979 content=$(jq -c . < "$file")
8080 json_array+="{\"filename\":\"$file\",\"content\":$content},"
8181 else
8282 echo "⚠️ Skipping invalid or missing JSON: $file"
8383 fi
8484 done
85+
8586 # Finalize array
8687 json_array="${json_array%,}]"
8788 echo "✅ Final JSON array:"
0 commit comments