GitHub Actions workflow
The workflow runs from the trusted base branch withpull_request_target, then
checks out the base commit so the review script itself cannot be replaced by
the pull request. Store NULLSPACE_API_KEY, NULLSPACE_API_URL, and
OPENAI_API_KEY as GitHub Actions secrets. For private repositories, add a
separate read-only GIT_READ_TOKEN secret for sandbox-side Git clone and fetch
operations.
Review script
The workflow calls this script on every pull request. It creates a Nullspace sandbox, fetches the PR branch inside the sandbox, sends the diff to an LLM, runs your test command, and posts one PR comment with the review and validation result.How it works
- Run trusted orchestration — the GitHub runner checks out the base commit, installs the Nullspace SDK, and runs the review script from trusted code.
- Create sandbox —
Sandbox.create()starts a disposable Nullspace VM for the pull request. - Fetch the PR —
sandbox.git.clone()checks out the base branch, then a sandbox-localgit fetchloadsrefs/pull/<number>/head. - AI review —
commands.run()generates a diff inside the sandbox and the runner sends it to an LLM. - Run validation — the script runs
INSTALL_COMMANDandTEST_COMMANDinside the sandbox. Nullspace command results reportexit_code,stdout, andstderr; non-zero exits are handled explicitly. - Post results — the runner posts one PR comment through the GitHub REST API after the sandbox closes.
Security notes
- Do not check out the PR branch on the GitHub runner when using
pull_request_target. - Do not pass
GITHUB_TOKEN,OPENAI_API_KEY, orNULLSPACE_API_KEYinto the sandbox environment. The example keeps those values runner-side. - Leave
GIT_READ_TOKENunset for public repositories. For private repositories, use a token scoped only for read access because PR code can read any credentials made available inside the sandbox. - Build a custom Nullspace template for heavyweight CI dependencies such as browsers, language toolchains, or system packages.
Related guides
Git helpers
Clone repositories, manage branches, inspect diffs, and push changes from sandboxes.
Commands
Run foreground, streaming, and background commands inside a sandbox.
Custom templates
Preinstall toolchains and CI dependencies for repeatable sandbox runs.
Agents
Run Codex, Claude Code, Amp, OpenCode, or custom agents in isolated workspaces.