Skip to content

Commit 4a36e8d

Browse files
Merge branch 'trial-testing:main' into main
2 parents bc2755f + c02cb7f commit 4a36e8d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .github/workflows/test-oidc-get.yml
2+
name: Test OIDC GET Request
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
id-token: write # enable OIDC token issuance
11+
contents: read # allows checkout (not strictly needed here)
12+
13+
jobs:
14+
oidc-get:
15+
runs-on: ubuntu-latest
16+
env:
17+
CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
18+
API_URL: https://sentintel-content-dev-fue4ashcg9fnfge9.canadacentral-01.azurewebsites.net/ # πŸ” replace with your GET endpoint
19+
20+
steps:
21+
- name: πŸ” Request OIDC token from GitHub
22+
id: fetch_token
23+
run: |
24+
echo "🌐 Requesting OIDC token..."
25+
raw=$(curl -s \
26+
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
27+
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=api://${CLIENT_ID}")
28+
echo "πŸ” Raw token response JSON: $raw"
29+
token=$(echo "$raw" | jq -r '.value')
30+
echo "βœ”οΈ Token length: ${#token}"
31+
echo "TOKEN=$token" >> $GITHUB_ENV
32+
33+
- name: πŸ“‘ Send GET request with Bearer token
34+
run: |
35+
echo "πŸš€ Sending GET to $API_URL"
36+
response=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_URL")
37+
echo "πŸ” Response JSON:"
38+
echo "$response" | jq .

0 commit comments

Comments
Β (0)