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 ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-github |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
owner | string | Yes | — | Repository owner |
repo | string | Yes | — | Repository name |
pr_number | integer | Yes | — | Pull request number |
expected_head_sha | string | No | — | Expected PR head commit SHA |
dry_run | boolean | No | — | Plan without mutating GitHub |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
status | string | No | — | — |
applied | boolean | No | — | — |
dry_run | boolean | No | — | — |
previous_state | string | No | — | — |
state | string | No | — | — |
merged | boolean | No | — | — |
head_sha | string | No | — | — |
head_branch | string | No | — | — |
base_branch | string | No | — | — |
pr_url | string | No | — | — |
expected_head_sha | string | No | — | — |
owner | string | No | — | — |
repo | string | No | — | — |
pr_number | integer | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
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
}
}