Convert a pull request to a draft
curl --request POST \
--url https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"checks": [
{
"check_run_id": 4503599627370495,
"name": "<string>",
"status": "<string>",
"summary_truncated": true,
"completed_at": "2023-11-07T05:31:56Z",
"conclusion": "<string>",
"details_url": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"summary": "<string>"
}
],
"merge_box": {
"additions": 1,
"author_login": "<string>",
"checks_failed": 1,
"checks_passed": 1,
"checks_total": 1,
"commits": 1,
"deletions": 1,
"draft": true,
"head_is_fork": true,
"head_sha": "<string>",
"html_url": "<string>",
"pr_number": 2,
"ready_for_merge": true,
"title": "<string>",
"base_branch": "<string>",
"base_sha": "<string>",
"ci_status": "pending",
"head_branch": "<string>",
"mergeable_state": "clean",
"merged_at": "2023-11-07T05:31:56Z",
"stack_children": [
{
"html_url": "<string>",
"pr_number": 2,
"pull_request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "open",
"title": "<string>"
}
],
"stack_parent": {
"html_url": "<string>",
"pr_number": 2,
"pull_request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "open",
"title": "<string>"
},
"state": "open"
},
"reviewers": [
{
"decision": "approved",
"is_bot": true,
"kind": "user",
"login": "<string>"
}
],
"reviews": [
{
"author_is_bot": true,
"author_login": "<string>",
"body": "<string>",
"github_review_id": 4503599627370496,
"html_url": "<string>",
"state": "<string>",
"submitted_at": "2023-11-07T05:31:56Z"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Pull Requests
Convert a pull request to a draft
Converts a pull request to a draft as the caller’s own GitHub user, and answers with the pull request read after the change.
Use this tool when you need to:
- Signal that a pull request is not ready for review or merge yet
- Pull an open pull request back to draft while it is reworked
Examples:
- POST /pull-requests//github/draft
- POST /pull-requests/6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21/github/draft?org_id=0b9d3e57-2c1a-4f6e-8d7b-5a4c3e2f1d09
Hints:
- pullRequestID is the pull request’s uuid and org_id an optional uuid naming the owning organization to act in, the org_id getPullRequest answers; either one that is not a uuid is a 422 from the schema. There is no body and no idempotency key.
- The App installation reads the pull request first: one already a draft is left as it is and answered, and otherwise GitHub’s GraphQL draft conversion runs with the caller’s own token, so GitHub judges their permission.
- Answers 200 with the GitHubPullRequest, the shape getPullRequestGithub reads, as read after the change; the mirror records the pull request GitHub answers with, so the next read reflects the change before its webhook arrives.
- Use markPullRequestGithubReady instead to mark a draft ready for review, and closePullRequestGithub to close it.
- A member with a product role (owner, admin or member) in an owning organization of the pull request (one whose task published or reviewed it, or with a project on its repository) may call it while they keep GitHub access to its repository.
- A viewer or billing member is refused with 403 org_role_insufficient and a suspended organization with 403 org_suspended, each when no other owning organization admits the caller, and an agent host’s grant with 403 agent_host_route_not_allowed; 503 when the membership check is unavailable.
- A caller linked to the repository’s installation whose GitHub authorization is missing or revoked is refused with 409 github_identity_required (reconnect GitHub); GitHub refusing the caller (GraphQL FORBIDDEN, INSUFFICIENT_SCOPES or UNPROCESSABLE, or a 403 or 422) is a 422 with GitHub’s message, and any other GitHub failure a 502.
- A pull request that does not exist, one no organization of the caller owns, an org_id that does not own it and one whose repository the caller cannot see on GitHub (no link to its installation included) answer the same 404; omitting org_id while more than one owning organization admits the caller is a 422 org_id_required, and a GitHub access check that cannot run is a 500.
POST
/
pull-requests
/
{pullRequestID}
/
github
/
draft
Convert a pull request to a draft
curl --request POST \
--url https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/pull-requests/{pullRequestID}/github/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"checks": [
{
"check_run_id": 4503599627370495,
"name": "<string>",
"status": "<string>",
"summary_truncated": true,
"completed_at": "2023-11-07T05:31:56Z",
"conclusion": "<string>",
"details_url": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"summary": "<string>"
}
],
"merge_box": {
"additions": 1,
"author_login": "<string>",
"checks_failed": 1,
"checks_passed": 1,
"checks_total": 1,
"commits": 1,
"deletions": 1,
"draft": true,
"head_is_fork": true,
"head_sha": "<string>",
"html_url": "<string>",
"pr_number": 2,
"ready_for_merge": true,
"title": "<string>",
"base_branch": "<string>",
"base_sha": "<string>",
"ci_status": "pending",
"head_branch": "<string>",
"mergeable_state": "clean",
"merged_at": "2023-11-07T05:31:56Z",
"stack_children": [
{
"html_url": "<string>",
"pr_number": 2,
"pull_request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "open",
"title": "<string>"
}
],
"stack_parent": {
"html_url": "<string>",
"pr_number": 2,
"pull_request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "open",
"title": "<string>"
},
"state": "open"
},
"reviewers": [
{
"decision": "approved",
"is_bot": true,
"kind": "user",
"login": "<string>"
}
],
"reviews": [
{
"author_is_bot": true,
"author_login": "<string>",
"body": "<string>",
"github_review_id": 4503599627370496,
"html_url": "<string>",
"state": "<string>",
"submitted_at": "2023-11-07T05:31:56Z"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Authorizations
Query Parameters
The pull request's owning organization to act in: the org_id the PullRequest carries. Omitted, getPullRequest and the review page's operations (its review, file, head snapshot and stack) act in the owning organization getPullRequest ranks first, and a console operation refuses with 422 org_id_required when more than one of the caller's organizations owns the pull request.