type Github = {
token: string;
};
/**
* Update a pull request
* Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
pull_number: string,
body: {
base?: string;
body?: string;
maintainer_can_modify?: boolean;
state?: "open" | "closed";
title?: string;
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/pulls/${pull_number}`
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Update a pull request
* Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
pull_number: string,
body: {
base?: string;
body?: string;
maintainer_can_modify?: boolean;
state?: "open" | "closed";
title?: string;
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/pulls/${pull_number}`
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 927 days ago