type Github = {
token: string;
};
/**
* Submit a review for a pull request
* Submits a pending review for a pull request. For more information about creating a pending review for a pull request, see "[Create a review for a pull request](https://docs.github.com/rest/pulls#create-a-review-for-a-pull-request)."
*/
export async function main(
auth: Github,
owner: string,
repo: string,
pull_number: string,
review_id: string,
body: {
body?: string;
event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT";
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/pulls/${pull_number}/reviews/${review_id}/events`
);
const response = await fetch(url, {
method: "POST",
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;
};
/**
* Submit a review for a pull request
* Submits a pending review for a pull request. For more information about creating a pending review for a pull request, see "[Create a review for a pull request](https://docs.github.com/rest/pulls#create-a-review-for-a-pull-request)."
*/
export async function main(
auth: Github,
owner: string,
repo: string,
pull_number: string,
review_id: string,
body: {
body?: string;
event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT";
[k: string]: unknown;
}
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/pulls/${pull_number}/reviews/${review_id}/events`
);
const response = await fetch(url, {
method: "POST",
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