@@ -11,7 +11,7 @@ permissions:
1111
1212env :
1313 CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
14- API_BASE : https://sentintel-content-dev-fue4ashcg9fnfge9.canadacentral-01.azurewebsites.net
14+ API_BASE : ${{ secrets.SENTINEL_CONTENT_API_URL }}
1515
1616jobs :
1717 pr-validate :
@@ -48,50 +48,47 @@ jobs:
4848
4949
5050
51- # 4. Collect & inspect changed JSON files
51+ # 4. Collect & inspect changed JSON files (fixed)
5252 - name : 📁 Collect & inspect changed JSON files
5353 id : prepare_json_files
5454 run : |
5555 echo "🔍 Finding changed JSON files..."
5656 BASE_BRANCH=${{ github.event.pull_request.base.ref }}
57- HEAD_SHA=${{ github.event.pull_request.head.sha }}
5857 echo "Base branch: $BASE_BRANCH"
59- echo "Head SHA: $HEAD_SHA"
6058
61- # Fetch the base branch into FETCH_HEAD
59+ # 1) Fetch the latest main so origin/main is up to date
6260 git fetch origin $BASE_BRANCH
63- echo "✅ Fetched origin/$BASE_BRANCH to FETCH_HEAD "
61+ echo "✅ Fetched origin/$BASE_BRANCH"
6462
65- # List changed files between FETCH_HEAD (base) and HEAD_SHA
66- all_changed=$(git diff --name-only FETCH_HEAD $HEAD_SHA )
67- echo "🔁 All changed files:"
63+ # 2) Diff using three-dot syntax against HEAD
64+ all_changed=$(git diff --name-only origin/$BASE_BRANCH...HEAD )
65+ echo "🔁 All changed files in PR :"
6866 echo "$all_changed"
6967
70- # Filter .json files
68+ # 3) Filter for .json
7169 mapfile -t files < <(echo "$all_changed" | grep '\.json$' || true)
7270 echo "🧾 JSON files to process (${#files[@]}): ${files[*]:-<none>}"
7371
74- # Build JSON array
72+ # 4) Build the JSON array
7573 json_array="["
7674 for file in "${files[@]}"; do
77- echo "📄 Checking file: $file"
75+ echo "📄 Checking $file"
7876 if [ -f "$file" ] && jq -e . "$file" > /dev/null; then
7977 content=$(jq -c . < "$file")
8078 json_array+="{\"filename\":\"$file\",\"content\":$content},"
8179 else
82- echo "⚠️ Skipping invalid or missing JSON: $file"
80+ echo "⚠️ Skipping invalid/ missing JSON: $file"
8381 fi
8482 done
85-
86- # Finalize array
8783 json_array="${json_array%,}]"
84+
85+ # 5) Debug and save
8886 echo "✅ Final JSON array:"
8987 echo "$json_array"
90-
91- # Save payload
9288 echo "$json_array" > files_payload.json
9389 echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
94- echo "✅ Payload saved (size: $(wc -c < files_payload.json) bytes)"
90+ echo "✅ Payload size: $(wc -c < files_payload.json) bytes"
91+
9592
9693
9794 # 5. Send POST request with JSON payload to "/"
0 commit comments