multi-router.aidocs

Machine Identity

GitHub ActionsEnterprise

Calling Multi-Router from a GitHub Actions workflow with its OIDC token.

A GitHub Actions workflow authenticates to Multi-Router with the OpenID Connect token GitHub issues to each run. GitHub is the issuer, and the subject names the repository and what triggered the run, such as a branch or an environment. The workflow's only credential is that token.

Registering GitHub Actions

Register https://token.actions.githubusercontent.com as an issuer, authorize the organization that owns the routers, and copy the token audience. See Issuers.

Binding the repository

Add a binding with Caller type CI job, and one of these subjects:

SubjectMatchCovers
repo:example-co/billing:ref:refs/heads/mainThis exact subjectRuns on the main branch.
repo:example-co/billing:environment:productionThis exact subjectJobs in the production environment.
repo:example-co/billingAnything under a prefixEvery run of the repository.

Prefixes on GitHub Actions name a complete owner and repository, because GitHub issues tokens for every repository on GitHub. See Bindings.

The workflow

The workflow requests the id-token: write permission, fetches a token for the issuer's audience, and sends it as a bearer token:

.github/workflows/summarize.ymlyaml
name: Summarize release notes
on:
  push:
    branches: [main]
permissions:
  id-token: write
  contents: read
jobs:
  summarize:
    runs-on: ubuntu-latest
    steps:
      - name: Get a Multi-Router token
        run: |
          TOKEN=$(curl -s -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
            "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=mr-aud_EXAMPLEp3Qk9Zt2Lw8Vd4Nc6Ys1Hb7Rm0Xf5Jg2TaQe" | jq -r .value)
          echo "::add-mask::$TOKEN"
          echo "MR_TOKEN=$TOKEN" >> "$GITHUB_ENV"
      - name: Call Multi-Router
        run: |
          curl https://api.multi-router.ai/v1/chat/completions \
            -H "Authorization: Bearer $MR_TOKEN" \
            -H "Content-Type: application/json" \
            -d '{ "messages": [{ "role": "user", "content": "Summarize the changes in this release." }] }'

GitHub's tokens last a few minutes, within the issuer's maximum token lifetime. A long job fetches a new token before the old one expires.

KubernetesCalling Multi-Router
Was this helpful?