Authenticate GitHub Actions with workload identity federation
A GitHub Actions job can request an OIDC token from GitHub and exchange it for a short-lived Limrun access token. Your repositories then need no LIM_API_KEY secret, and you control which repositories and branches get which permissions.
Before you start
You need:
- The
adminrole in your Limrun organization. - The numeric ID of the GitHub organization or user that owns your repositories. Run
gh api orgs/YOUR_ORG --jq .idfor an organization orgh api users/YOUR_USER --jq .idfor a user.
Create the provider
GitHub signs tokens for every repository on GitHub, so the provider condition must check that a token comes from your organization.
-
Open console.limrun.com, go to Settings, then Workload identity federation, and click the + button next to Identity providers.
-
In Issuer, choose GitHub Actions. The preset fills in the issuer
https://token.actions.githubusercontent.comand its signing keys. -
Keep Token audience as
limrun. The workflow requests its token with this audience. -
In Provider condition (CEL), replace
OWNER_IDwith your organization's or user's numeric ID:assertion.repository_owner_id == 'OWNER_ID'GitHub sends IDs as strings, so keep the quotes. Use the ID rather than the name, because an organization can be renamed and its old name claimed by someone else.
-
Click Create provider.
Create a binding
-
In the provider's card, click the + button next to Bindings.
-
Enter a name and a Claim condition (CEL) that selects the workflows to trust. For example, this admits only the
mainbranch of one repository:assertion.repository_id == 'REPOSITORY_ID' && assertion.ref == 'refs/heads/main'Run
gh api repos/YOUR_ORG/YOUR_REPO --jq .idto find the repository ID. -
Enter the permissions the workflows need, one per line, such as
xcode:*:all. -
Click Create binding, expand Setup, and copy the binding ID.
-
In GitHub, add the binding ID as a repository or organization variable named
LIMRUN_BINDING_ID. It is not a secret.
Use the token in a workflow
GitHub's tokens are short-lived, and a Limrun access token never outlives the token it was exchanged for. This job writes a fresh token to a file every two minutes in the background, and the CLI reads the file again whenever it renews its Limrun token:
name: Limrun
on: push
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
LIMRUN_WORKLOAD_IDENTITY_BINDING_ID: ${{ vars.LIMRUN_BINDING_ID }}
LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE: ${{ runner.temp }}/limrun.jwt
steps:
- uses: actions/checkout@v4
- run: npm install --global lim
- name: Keep a GitHub token for Limrun
run: |
refresh() {
curl -sS --fail-with-body -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=limrun" | jq -r .value > "$LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE.tmp"
mv "$LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE.tmp" "$LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE"
}
refresh
(while sleep 120; do refresh; done) &
- run: lim whoamiid-token: write lets the job request tokens from GitHub, and contents: read keeps checkout working. ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN are set by GitHub, and &audience=limrun must match the provider's audience. Writing to a temporary file and renaming it means the CLI never reads a half-written token. After lim whoami shows your organization and the binding's permissions, replace it with your build steps.
In a Node script, the @actions/core package can return the token for the TypeScript SDK on every exchange: new Limrun({ workloadToken: () => core.getIDToken('limrun'), bindingId }).
Things to know
- Pull requests from forks get no token by default. GitHub makes their
id-tokenpermission read-only unless an admin enables sending write tokens to pull request workflows. Run Limrun steps on branches in your own repository. - The subject format depends on the repository. Repositories created after July 15, 2026 put owner and repository IDs into
sub, and organizations can customize it. Match onrepository_owner_id,repository_id, andrefinstead ofsub.
See GitHub's OIDC reference for every claim in the token.
Let GitHub Actions workflows call Limrun with their OIDC token instead of a stored API key.
Was this guide helpful?