Skip to content
Proud to collaborate with Microsoft for Startups

github.pulls.close_pr ​

Close an open GitHub pull request without merging it

Close an open GitHub pull request without merging it.

Inputs:

  • owner: Repository owner (required).
  • repo: Repository name (required).
  • pr_number: Pull request number (required).
  • expected_head_sha: Expected PR head SHA guard (optional).
  • dry_run: Plan without mutating GitHub (optional, default: false).

Outputs (terminal state_data):

  • status: planned | closed | already_closed | already_merged
  • applied: bool
  • state: open | closed
  • merged: bool
  • head_sha: str
  • pr_url: str

Compensation: A closed, unmerged PR can normally be reopened with GitHub's PR API while its head branch still exists. Plugin required: context.get_plugin("github") must expose a GitHub App installation.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-github
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
ownerstringYes—Repository owner
repostringYes—Repository name
pr_numberintegerYes—Pull request number
expected_head_shastringNo—Expected PR head commit SHA
dry_runbooleanNo—Plan without mutating GitHub

Output Schema ​

FieldTypeRequiredDefaultDescription
statusstringNo——
appliedbooleanNo——
dry_runbooleanNo——
previous_statestringNo——
statestringNo——
mergedbooleanNo——
head_shastringNo——
head_branchstringNo——
base_branchstringNo——
pr_urlstringNo——
expected_head_shastringNo——
ownerstringNo——
repostringNo——
pr_numberintegerNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
failed_stepstringNo——
failed_layerstringNo——
errorstringNo——
error_typestringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "github.pulls.close_pr",
  "initial_data": {
    "owner": "value",
    "repo": "value",
    "pr_number": 123
  }
}