Skip to content

Commit 97d8468

Browse files
Merge branch 'trial-testing:main' into main
2 parents 21a756f + fe71ff3 commit 97d8468

File tree

2 files changed

+6
-59
lines changed

2 files changed

+6
-59
lines changed

.github/workflows/auth_try.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
# 1. Fetch OIDC token in trusted context
22-
- name: 🔐 Request OIDC token from GitHub
23-
id: oidc
24-
run: |
25-
echo "🌐 Fetching OIDC token for audience: api://${CLIENT_ID}"
26-
raw=$(curl -s \
27-
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
28-
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=api://${CLIENT_ID}")
29-
token=$(echo "$raw" | jq -r '.value')
30-
echo "TOKEN=$token" >> $GITHUB_ENV
31-
3221
- name: 🔄 Checkout PR HEAD at exact commit
3322
uses: actions/checkout@v3
3423
with:
Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,55 @@
1-
name: Validation check for CCP data connectors
1+
name: pull_request_target
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, synchronize]
66

7-
permissions:
8-
id-token: write # enable OIDC token issuance
9-
contents: read # allow checkout of code
10-
11-
env:
12-
CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
13-
API_BASE: ${{ secrets.SENTINEL_CONTENT_API_URL }}
14-
15-
167
jobs:
178
send-json-files:
189
runs-on: ubuntu-latest
19-
2010
steps:
21-
22-
23-
24-
# 1. Fetch OIDC token in trusted context
25-
- name: 🔐 Request OIDC token from GitHub
26-
id: oidc
27-
run: |
28-
echo "🌐 Fetching OIDC token for audience: api://${CLIENT_ID}"
29-
raw=$(curl -s \
30-
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
31-
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=api://${CLIENT_ID}")
32-
token=$(echo "$raw" | jq -r '.value')
33-
echo "TOKEN=$token" >> $GITHUB_ENV
34-
35-
36-
37-
38-
39-
40-
4111
- name: Checkout PR code
4212
uses: actions/checkout@v3
4313
with:
4414
fetch-depth: 0
15+
ref: ${{ github.event.pull_request.head.ref }}
16+
repository: ${{ github.event.pull_request.head.repo.full_name }}
4517

4618
- name: Get changed JSON files and contents to send to API endpoint
4719
id: prepare_json_files
4820
run: |
4921
echo "Collecting changed JSON files..."
50-
5122
BASE="origin/${{ github.event.pull_request.base.ref }}"
5223
HEAD="${{ github.event.pull_request.head.sha }}"
53-
54-
# Get changed files with .json extension
5524
mapfile -t files < <(git diff --name-only "$BASE" "$HEAD" | grep '\.json$')
56-
5725
json_array="["
5826
for file in "${files[@]}"; do
5927
if [ -f "$file" ]; then
6028
if jq -e . "$file" > /dev/null 2>&1; then
61-
content=$(jq -c . < "$file") # compact JSON
29+
content=$(jq -c . < "$file")
6230
json_array+="{\"filename\": \"${file}\", \"content\": $content},"
6331
else
6432
echo "❌ Invalid JSON structure in file: $file"
6533
exit 1
6634
fi
6735
fi
6836
done
69-
70-
# Finalize the JSON array
7137
json_array="${json_array%,}]"
72-
7338
echo "$json_array" > files_payload.json
7439
echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
75-
cat files_payload.json
76-
77-
7840
7941
- name: Send JSON files to API and check response
8042
env:
81-
API_URL: ${{ secrets.SENTINEL_CONTENT_API_URL }}
43+
API_URL: https://valid1-e2akhdekg6a7a2ch.canadacentral-01.azurewebsites.net/
8244
run: |
8345
echo "Sending JSON payload to API"
84-
8546
response=$(curl -s -X POST "$API_URL" \
8647
-H "Content-Type: application/json" \
8748
--data-binary "@$JSON_PAYLOAD_PATH")
88-
8949
status=$(jq -r '.status' <<< "$response")
9050
message=$(jq -r '.message' <<< "$response")
91-
9251
if [ "$status" != "passed" ]; then
9352
echo "❌ Test Fail : $message"
9453
exit 1
9554
fi
96-
9755
echo "✅ $message"

0 commit comments

Comments
 (0)