Skip to content

.github/workflows/oidc.yml #4

.github/workflows/oidc.yml

.github/workflows/oidc.yml #4

Workflow file for this run

name: API Call with OIDC Authentication
on:
workflow_dispatch: # Enables manual trigger from GitHub UI
jobs:
call-api:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Necessary to request an OIDC token
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Obtain OIDC Token
id: get_oidc
uses: actions/oidc-client@v1 # Official action to obtain OIDC token
- name: Call External API
run: |
curl -X POST "https://charming-termite-surely.ngrok-free.app" \
-H "Authorization: Bearer ${{ steps.get_oidc.outputs.token }}" \
-H "Content-Type: application/json" \
-d '{"data": "Hello from GitHub Actions!"}'