type Github = {
token: string;
};
/**
* Remove a repository from an app installation
* Remove a single repository from an installation. The authenticated user must have admin access to the repository.
You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint.
*/
export async function main(
auth: Github,
installation_id: string,
repository_id: string
) {
const url = new URL(
`https://api.github.com/user/installations/${installation_id}/repositories/${repository_id}`
);
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 a repository from an app installation
* Remove a single repository from an installation. The authenticated user must have admin access to the repository.
You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint.
*/
export async function main(
auth: Github,
installation_id: string,
repository_id: string
) {
const url = new URL(
`https://api.github.com/user/installations/${installation_id}/repositories/${repository_id}`
);
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