Skip to content

steps/workspaces ​

Prepare a run-owned worktree for a configured GitHub binding.

provisionWorktree cuts the run's own branch and working copy from the binding's clone; provisionPullRequestWorktree checks out a pull request's head instead. Call their generated #jigs/steps wrappers from workflow code so a resumed workflow receives the recorded workspace information. The low-level functions here belong inside a factory-owned "use step" implementation.

Worktrees ​

PullRequestWorktreeRequest ​

The binding and pull request used to provision a worktree at the pull request's head.

Properties ​

PropertyTypeDescription
bindingstringThe binding whose repository the pull request is on.
numbernumberThe pull request's number.

WorktreeRequest ​

The binding and branch used to provision a run's worktree.

Properties ​

PropertyTypeDescription
bindingstring-
branchstringThe branch name to start from; the run's own branch adds a suffix from its run ID.

listBindings() ​

ts
function listBindings(): RepositoryRef & object[];

Every binding in the factory's configuration, with the repository it points at.

Returns ​

RepositoryRef & object[]


provisionPullRequestWorktree() ​

ts
function provisionPullRequestWorktree(request, metadata): Promise<PullRequestWorktree>;

Check out a pull request's current head in a worktree of its own, and prepare its files and dependencies.

Parameters ​

ParameterType
requestPullRequestWorktreeRequest
metadataRunMetadata

Returns ​

Promise<PullRequestWorktree>

Remarks ​

Only a pull request from a branch of the binding's own repository is checked out, never one from a fork, because the binding's setup runs the pull request's code. The worktree has no branch, so nothing in it is pushed. Each head gets its own worktree, so a run that provisions again after a push gets the new head beside the old one. Pass the returned headSha to mergePullRequest to merge only the commit that was checked.


provisionWorktree() ​

ts
function provisionWorktree(request, metadata): Promise<Worktree>;

Create this run's own branch and worktree from the default branch, and prepare its files and dependencies.

Parameters ​

ParameterType
requestWorktreeRequest
metadataRunMetadata

Returns ​

Promise<Worktree>

Remarks ​

Every run gets a new branch, so a run never picks up another run's work. The returned branch is the one to push and open a pull request from.