Skip to content

Commit 972300c

Browse files
Merge branch 'trial-testing:main' into main
2 parents 1a84cb3 + 0e1a2df commit 972300c

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

β€Ž.github/workflows/auth_try.ymlβ€Ž

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
env:
1313
CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
14-
API_BASE: https://sentintel-content-dev-fue4ashcg9fnfge9.canadacentral-01.azurewebsites.net/ # πŸ” replace with your App Service base URL
14+
API_BASE: https://sentintel-content-dev-fue4ashcg9fnfge9.canadacentral-01.azurewebsites.net
1515

1616
jobs:
1717
pr-validate:
@@ -26,9 +26,7 @@ jobs:
2626
raw=$(curl -s \
2727
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
2828
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=api://${CLIENT_ID}")
29-
echo "πŸ” Token response: $raw"
3029
token=$(echo "$raw" | jq -r '.value')
31-
echo "βœ”οΈ Token length: ${#token}"
3230
echo "TOKEN=$token" >> $GITHUB_ENV
3331
3432
# 2. Checkout the PR head (untrusted code)
@@ -39,8 +37,8 @@ jobs:
3937
ref: ${{ github.event.pull_request.head.ref }}
4038
fetch-depth: 0
4139

42-
# 3. Send a simple GET request to verify connectivity
43-
- name: πŸ“‘ Send GET request to protected endpoint
40+
# 3. Send a simple GET request to "/"
41+
- name: πŸ“‘ Send GET request to protected root endpoint
4442
run: |
4543
echo "πŸš€ GET $API_BASE/"
4644
response=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_BASE/")
@@ -51,46 +49,33 @@ jobs:
5149
- name: πŸ“ Collect changed JSON files
5250
id: prepare_json_files
5351
run: |
54-
echo "πŸ” Finding changed JSON files..."
5552
BASE="origin/${{ github.event.pull_request.base.ref }}"
5653
HEAD="${{ github.event.pull_request.head.sha }}"
57-
echo "Base ref: $BASE"
58-
echo "Head SHA: $HEAD"
59-
6054
mapfile -t files < <(git diff --name-only "$BASE" "$HEAD" | grep '\.json$')
61-
echo "🧾 Changed JSON files: ${files[*]:-<none>}"
62-
6355
json_array="["
6456
for file in "${files[@]}"; do
65-
echo "πŸ“„ Processing $file"
66-
if [ -f "$file" ] && jq -e . "$file" > /dev/null 2>&1; then
57+
if [ -f "$file" ] && jq -e . "$file" > /dev/null; then
6758
content=$(jq -c . < "$file")
6859
json_array+="{\"filename\":\"$file\",\"content\":$content},"
69-
else
70-
echo "❌ Skipping invalid or missing JSON: $file"
7160
fi
7261
done
7362
json_array="${json_array%,}]"
7463
echo "$json_array" > files_payload.json
75-
echo "βœ… Payload written to files_payload.json"
7664
echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
7765
78-
# 5. Send POST request with JSON payload
79-
- name: πŸš€ Send POST request with JSON payload
66+
# 5. Send POST request with JSON payload to "/"
67+
- name: πŸš€ Send POST request with JSON payload to root
8068
run: |
8169
echo "πŸš€ POST $API_BASE/"
8270
response=$(curl -s -w "\n%{http_code}" -X POST "$API_BASE/" \
8371
-H "Authorization: Bearer $TOKEN" \
8472
-H "Content-Type: application/json" \
8573
--data-binary "@$JSON_PAYLOAD_PATH")
86-
8774
body=$(echo "$response" | head -n -1)
8875
status_code=$(echo "$response" | tail -n1)
89-
9076
echo "🌐 HTTP status: $status_code"
9177
echo "🌐 Response body:"
9278
echo "$body" | jq . || true
93-
9479
if [ "$status_code" -ne 200 ]; then
9580
echo "❌ POST failed (HTTP $status_code)"
9681
exit 1

0 commit comments

Comments
Β (0)