type Github = {
token: string;
};
/**
* Remove user as a collaborator
* Removes a collaborator from an organization project. You must be an organization owner or a project `admin` to remove a collaborator.
*/
export async function main(auth: Github, project_id: string, username: string) {
const url = new URL(
`https://api.github.com/projects/${project_id}/collaborators/${username}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Remove user as a collaborator
* Removes a collaborator from an organization project. You must be an organization owner or a project `admin` to remove a collaborator.
*/
export async function main(auth: Github, project_id: string, username: string) {
const url = new URL(
`https://api.github.com/projects/${project_id}/collaborators/${username}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 927 days ago