<GitHubPullRequest>
The <GitHubPullRequest> block provides a streamlined way to create GitHub pull requests directly from a runbook. It integrates with the <GitClone> block to push changes made during the runbook workflow and open a PR.
This block completes the git workflow loop: clone a repository, make changes (via Command, Template, or other blocks), and open a pull request.
Basic Usage
Section titled “Basic Usage”Pair with <GitHubAuth> and <GitClone> to create a complete workflow:
<GitHubAuth id="gh-auth" title="Connect to GitHub"/>
<GitClone id="clone-repo" gitHubAuthId="gh-auth" title="Clone Repository" prefilledUrl="https://github.com/acme-corp/infrastructure"/>
<GitHubPullRequest id="create-pr" githubAuthId="gh-auth" title="Open Pull Request" description="Create a PR with the changes made in this runbook"/>Pre-filled Values
Section titled “Pre-filled Values”You can pre-populate the PR title, description, labels, and branch name. Users can still edit these values before creating the PR.
<GitHubPullRequest id="create-pr" githubAuthId="gh-auth" prefilledPullRequestTitle="Add VPC module configuration" prefilledPullRequestDescription="## Changes\n- Added VPC module\n- Configured NAT gateway" prefilledPullRequestLabels={["enhancement", "terraform"]} prefilledBranchName="feature/add-vpc"/>Template Expressions
Section titled “Template Expressions”The prefilledPullRequestTitle, prefilledPullRequestDescription, and prefilledBranchName props support template expressions that reference outputs from other blocks:
<GitHubPullRequest id="create-pr" githubAuthId="gh-auth" prefilledPullRequestTitle="Add {{ ._blocks.config.outputs.MODULE_NAME }} module" prefilledBranchName="feature/{{ ._blocks.config.outputs.MODULE_NAME }}"/>Template expressions are resolved in real-time as upstream blocks produce outputs.
| Prop | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique block identifier. Used by downstream blocks to reference outputs. |
title | string | No | Display title for the block header. Supports inline markdown. |
description | string | No | Description text below the title. Supports inline markdown. |
githubAuthId | string | No | Reference to a <GitHubAuth> block. When set, the block waits for authentication to complete and uses the token for GitHub API access. |
prefilledPullRequestTitle | string | No | Pre-fills the PR title field. Supports template expressions. |
prefilledPullRequestDescription | string | No | Pre-fills the PR description field. Supports template expressions and markdown. |
prefilledPullRequestLabels | string[] | No | Pre-selects labels by name. Labels must exist in the repository. |
prefilledBranchName | string | No | Pre-fills the branch name. Supports template expressions. Defaults to runbook/<timestamp>. |
Block Outputs
Section titled “Block Outputs”After a successful PR creation, the block produces outputs that can be referenced by downstream blocks:
| Output | Description | Example |
|---|---|---|
PR_ID | The pull request number | 42 |
PR_URL | The full URL of the created pull request | https://github.com/org/repo/pull/42 |
Reference outputs in downstream blocks using template variables:
<Command id="notify" title="Post PR Link" command="echo 'PR created: {{ ._blocks.create_pr.outputs.PR_URL }}'"/>Git Push
Section titled “Git Push”After creating a PR, the block displays a “Git Push” button. This allows you to push additional changes made after the PR was created (for example, by running more Command or Template blocks). Each push stages all changes, commits them with the message “Additional changes”, and pushes to the same branch.
Prerequisites
Section titled “Prerequisites”The GitHubPullRequest block requires two prerequisites:
- GitHub authentication — A
<GitHubAuth>block must be completed to provide the GitHub token for API access. - A cloned repository — A
<GitClone>block must have successfully cloned a repository. The PR is created against this repository.
Both prerequisites are checked automatically, and the block shows amber warnings when they are not met:
- GitHub authentication: The block looks for a
GITHUB_TOKENoutput from theGitHubAuthblock referenced bygithubAuthId. When theGitHubAuthblock authenticates via pre-existing credentials (e.g., environment variables or the GitHub CLI) rather than its interactive OAuth flow, there is no explicitGITHUB_TOKENoutput — instead the block registers an__AUTHENTICATEDmarker to signal success. The prerequisite is satisfied by either. Until one is present, the block displays “Waiting for GitHub authentication” and names the specific block to complete. - Cloned repository: The block checks whether a
GitCloneblock has registered an active worktree. Until a repository has been cloned, the block displays “No repository available”. The block remains in apendingstate and the Create PR button is disabled until both prerequisites are satisfied.
Labels
Section titled “Labels”The block fetches available labels from the repository and presents them in a searchable multi-select dropdown. Labels can also be pre-selected using the prefilledPullRequestLabels prop.
Example: Full Workflow
Section titled “Example: Full Workflow”<GitHubAuth id="gh-auth" title="Authenticate to GitHub"/>
<GitClone id="clone-infra" gitHubAuthId="gh-auth" title="Clone Infrastructure Repo" prefilledUrl="https://github.com/acme-corp/infrastructure-live"/>
<Command id="make-changes" title="Apply Configuration" command="echo 'new_setting = true' >> config.hcl"/>
<GitHubPullRequest id="open-pr" githubAuthId="gh-auth" title="Open Pull Request" prefilledPullRequestTitle="Update infrastructure configuration" prefilledPullRequestLabels={["infrastructure"]}/>