Skip to content

Commit add658b

Browse files
Merge branch 'trial-testing:main' into main
2 parents df29872 + ca4a3ca commit add658b

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

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

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,36 @@ jobs:
1414

1515
env:
1616
API_URL: https://sentintel-content-dev-fue4ashcg9fnfge9.canadacentral-01.azurewebsites.net/ # πŸ” Replace with actual endpoint
17-
CLIENT_ID: "da7fd62a-590e-4e7a-8525-55ea01ffb1ac" # App Registration Client ID
17+
CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} # App Registration Client ID
1818

1919
steps:
2020
- name: πŸ”„ Checkout PR Code
2121
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 0
2424

25+
steps:
26+
- name: πŸ” Request OIDC token from GitHub
27+
id: fetch_token
28+
run: |
29+
echo "🌐 Requesting OIDC token..."
30+
raw=$(curl -s \
31+
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
32+
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=api://${CLIENT_ID}")
33+
echo "πŸ” Raw token response JSON: $raw"
34+
token=$(echo "$raw" | jq -r '.value')
35+
echo "βœ”οΈ Token length: ${#token}"
36+
echo "TOKEN=$token" >> $GITHUB_ENV
37+
38+
- name: πŸ“‘ Send GET request with Bearer token
39+
run: |
40+
echo "πŸš€ Sending GET to $API_URL"
41+
response=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_URL")
42+
echo "πŸ” Response JSON:"
43+
echo "$response" | jq .
44+
45+
46+
2547
- name: πŸ“ Collect Changed JSON Files
2648
id: prepare_json_files
2749
run: |
@@ -57,6 +79,7 @@ jobs:
5779
5880
echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
5981
82+
steps:
6083
- name: πŸ” Request OIDC token from GitHub
6184
id: fetch_token
6285
run: |
@@ -69,10 +92,29 @@ jobs:
6992
echo "βœ”οΈ Token length: ${#token}"
7093
echo "TOKEN=$token" >> $GITHUB_ENV
7194
72-
73-
- name: πŸ§ͺ Debug OIDC Token (first 50 chars)
95+
- name: πŸ“‘ Send GET request with Bearer token
7496
run: |
75-
echo "πŸ”‘ Partial token: ${{ steps.oidc.outputs.token }}" | cut -c1-50
97+
echo "πŸš€ Sending GET to $API_URL"
98+
response=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_URL")
99+
echo "πŸ” Response JSON:"
100+
echo "$response" | jq .
101+
102+
103+
104+
105+
106+
- name: πŸ” Request OIDC token from GitHub
107+
id: fetch_token
108+
run: |
109+
echo "🌐 Requesting OIDC token..."
110+
raw=$(curl -s \
111+
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
112+
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=api://${CLIENT_ID}")
113+
echo "πŸ” Raw token response JSON: $raw"
114+
token=$(echo "$raw" | jq -r '.value')
115+
echo "βœ”οΈ Token length: ${#token}"
116+
echo "TOKEN=$token" >> $GITHUB_ENV
117+
76118
77119
- name: πŸš€ Send Payload to Protected API
78120
run: |

0 commit comments

Comments
Β (0)