GitHub access
A GitHub integration holds a GitHub token in the broker. Sandboxes with a grant for it use git and gh as usual, while the broker adds the real token to each request.
The commands here use the beachside CLI connected to your broker. Without it, use beachside-broker with the same commands.
Add a GitHub integration
Section titled “Add a GitHub integration”Use a token with only the repositories and permissions the sandbox should have, such as a fine-grained personal access token. Read it from a protected file so it never appears in your shell history.
beachside broker integration create github --provider github --secret-stdin --allow-issue < /secure/path/github-token--allow-issue lets the issuer grant it right away. A broker can hold several GitHub integrations, such as github and github-tools, but each grant uses one.
Use it in a sandbox
Section titled “Use it in a sandbox”beachside create --name agent --network internet --grant githubFrom the SDK, pass broker.sandbox({ integrations: ["github"] }). The sandbox image needs Git, and GitHub CLI if you use gh.
- Git sends HTTPS URLs under
https://github.com/through the broker.git clone https://github.com/owner/repoworks unchanged. - GitHub CLI gets
GH_HOSTset to the broker host andGH_ENTERPRISE_TOKENset to the grant. Aghhost you selected explicitly, such asgithub.com, takes precedence overGH_HOST, so usegh api --hostname "$GH_HOST"or--repo "$GH_HOST/owner/repo"when in doubt. - The broker forwards the GitHub routes that Git and common
ghcommands use. The upstream token decides which repositories the sandbox can read or write. Supported routes.
For repositories owned by the GitHub account named gateway, include the .git suffix, as in https://github.com/gateway/project.git, because /gateway/ paths belong to the broker’s model gateways.
GitHub Actions
Section titled “GitHub Actions”A workflow can issue grants with its own OIDC token instead of an issuer key, so there is no long-lived secret in the repository. The broker only accepts workflows you list in its deployment configuration, and only for the integrations listed there.
-
Add the workflow to
BROKER_CONFIGin the broker’s.env.deployand runbun run deployagain. Deploys update settings like this one and leave the keys alone. Changes take effect only after a deploy. Workflow policy reference.{"githubActions": {"audience": "https://broker.example.com/github-actions","workflows": [{"repositoryId": "123456789","repositoryOwnerId": "23456789","repository": "example-org/review-service","ref": "refs/heads/main","workflowRef": "example-org/review-service/.github/workflows/review.yml@refs/heads/main","event": "push","integrations": ["github", "openrouter"]}]}} -
Allow the same integrations for issuance, if they aren’t already:
beachside broker issuer allow github openrouter. -
beachside broker config showconfirms what the deployed broker trusts. -
Give the job
permissions: { id-token: write }, install the client withnpm install @beachside/credential-client, and request grants on the runner:import { createCredentialBroker, githubActionsOidc } from "@beachside/credential-client";const broker = createCredentialBroker({url: process.env.BEACHSIDE_BROKER_URL!,auth: githubActionsOidc({audience: "https://broker.example.com/github-actions",env: process.env,}),});
Keep pull-request code out of the job that requests grants, and run it inside the sandbox instead. That matters most for pull_request_target and workflow_run events.
© 2026 Beachside Compute · Made by humans & in Texas