---
title: "GitHub Actions"
description: "Let GitHub Actions workflows call Limrun with their OIDC token instead of a stored API key."
canonical_url: "https://docs.limrun.com/docs/access/workload-identity-federation/github-actions"
markdown_url: "https://docs.limrun.com/docs/access/workload-identity-federation/github-actions.md"
last_updated: "2026-11-26"
x_farming_labs_generated_preamble: true
---

# GitHub Actions
URL: /docs/access/workload-identity-federation/github-actions
LLM index: /llms.txt
Description: Let GitHub Actions workflows call Limrun with their OIDC token instead of a stored API key.

# 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 `admin` role in your Limrun organization.
- The numeric ID of the GitHub organization or user that owns your repositories. Run `gh api orgs/YOUR_ORG --jq .id` for an organization or `gh api users/YOUR_USER --jq .id` for 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.

1. Open [console.limrun.com](https://console.limrun.com), go to **Settings**, then **Workload identity federation**, and click the **+** button next to **Identity providers**.
2. In **Issuer**, choose **GitHub Actions**. The preset fills in the issuer `https://token.actions.githubusercontent.com` and its signing keys.
3. Keep **Token audience** as `limrun`. The workflow requests its token with this audience.
4. In **Provider condition (CEL)**, replace `OWNER_ID` with your organization's or user's numeric ID:

   ```text
   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.
5. Click **Create provider**.

## Create a binding

1. In the provider's card, click the **+** button next to **Bindings**.
2. Enter a name and a **Claim condition (CEL)** that selects the workflows to trust. For example, this admits only the `main` branch of one repository:

   ```text
   assertion.repository_id == 'REPOSITORY_ID' && assertion.ref == 'refs/heads/main'
   ```

   Run `gh api repos/YOUR_ORG/YOUR_REPO --jq .id` to find the repository ID.
3. Enter the permissions the workflows need, one per line, such as `xcode:*:all`.
4. Click **Create binding**, expand **Setup**, and copy the binding ID.
5. 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:

```yaml title=".github/workflows/limrun.yml"
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 whoami
```

`id-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-token` permission 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 on `repository_owner_id`, `repository_id`, and `ref` instead of `sub`.

See [GitHub's OIDC reference](https://docs.github.com/en/actions/reference/security/oidc) for every claim in the token.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
