type Github = {
token: string;
};
/**
* Merge a pull request
* This endpoint triggers [notifications](https://docs.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
pull_number: string,
body: {
commit_message?: string;
commit_title?: string;
merge_method?: "merge" | "squash" | "rebase";
sha?: string;
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/pulls/${pull_number}/merge`
);
const response = await fetch(url, {
method: "PUT",
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 304 days ago
type Github = {
token: string;
};
/**
* Merge a pull request
* This endpoint triggers [notifications](https://docs.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
pull_number: string,
body: {
commit_message?: string;
commit_title?: string;
merge_method?: "merge" | "squash" | "rebase";
sha?: string;
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/pulls/${pull_number}/merge`
);
const response = await fetch(url, {
method: "PUT",
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 864 days ago