Skip to content
Browse documentation

Deployments

GitHub Actions

Use a short-lived GitHub identity to run or pull without storing a Bulgur API token in CI.

Create a workload identity

An organization owner or admin creates a GitHub Actions workload identity in Bulgur Settings. Bind it to one project and one concrete environment. Match the repository and owner numeric IDs, exact branch or tag ref, GitHub Environment name, and allowed event. You can also pin the workflow ref; a reusable workflow can be pinned with jobWorkflowRef.

The identity UUID can be stored as a GitHub repository variable. It is an identifier, not a Bulgur API token. The job needs id-token: write. GitHub pull_request events are not accepted by this policy model.

Policy fieldExample for this workflow
Repository ID / owner IDThe numeric IDs shown by GitHub, not repository names
Refrefs/heads/main
GitHub Environmentproduction
Allowed eventpush
Workflow ref (optional)your-org/your-repo/.github/workflows/deploy.yml@refs/heads/main

Run with a GitHub token

Add bulgur@^1.3.0 to the application's devDependencies before committing the lockfile. The CLI requests a GitHub-signed token for the fixed https://api.bulgur.dev audience, exchanges it for a short-lived Bulgur session, and reads only the identity's bound environment. No stored BULGUR_TOKEN is needed.

yaml
name: Build
on:
  push:
    branches: [main]
permissions:
  contents: read
jobs:
  build:
    runs-on: ubuntu-latest
    environment: production
    permissions:
      contents: read
      id-token: write
    env:
      BULGUR_AUTH: github-oidc
      BULGUR_IDENTITY_ID: ${{ vars.BULGUR_IDENTITY_ID }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npx bulgur run --auth github-oidc --identity "$BULGUR_IDENTITY_ID" -- npm run build

init does not wrap build scripts. Keep the explicit bulgur run command for this job; only remove it if you manually wrapped the build script yourself, to avoid running Bulgur twice.

What the session can do

  • The GitHub identity is matched against signed claims, not a mutable repository name alone. Its Bulgur session is limited to the bound environment and expires within five minutes.
  • GitHub OIDC mode is explicit for CLI run and pull. Authentication failure does not fall back to a saved login or BULGUR_TOKEN, and BULGUR_SKIP=1 cannot bypass it.
  • The session can read its environment's merged Shared values, but cannot write secrets or read a sibling environment. The run child does not inherit GitHub token-request or Bulgur authentication variables.