type Github = {
token: string;
};
/**
* Update a repository
* **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
allow_auto_merge?: boolean;
allow_forking?: boolean;
allow_merge_commit?: boolean;
allow_rebase_merge?: boolean;
allow_squash_merge?: boolean;
allow_update_branch?: boolean;
archived?: boolean;
default_branch?: string;
delete_branch_on_merge?: boolean;
description?: string;
has_issues?: boolean;
has_projects?: boolean;
has_wiki?: boolean;
homepage?: string;
is_template?: boolean;
merge_commit_message?: "PR_BODY" | "PR_TITLE" | "BLANK";
merge_commit_title?: "PR_TITLE" | "MERGE_MESSAGE";
name?: string;
private?: boolean;
security_and_analysis?: {
advanced_security?: { status?: string; [k: string]: unknown };
secret_scanning?: { status?: string; [k: string]: unknown };
secret_scanning_push_protection?: {
status?: string;
[k: string]: unknown;
};
[k: string]: unknown;
};
squash_merge_commit_message?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK";
squash_merge_commit_title?: "PR_TITLE" | "COMMIT_OR_PR_TITLE";
use_squash_pr_title_as_default?: boolean;
visibility?: "public" | "private";
web_commit_signoff_required?: boolean;
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}`);
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 repository
* **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: {
allow_auto_merge?: boolean;
allow_forking?: boolean;
allow_merge_commit?: boolean;
allow_rebase_merge?: boolean;
allow_squash_merge?: boolean;
allow_update_branch?: boolean;
archived?: boolean;
default_branch?: string;
delete_branch_on_merge?: boolean;
description?: string;
has_issues?: boolean;
has_projects?: boolean;
has_wiki?: boolean;
homepage?: string;
is_template?: boolean;
merge_commit_message?: "PR_BODY" | "PR_TITLE" | "BLANK";
merge_commit_title?: "PR_TITLE" | "MERGE_MESSAGE";
name?: string;
private?: boolean;
security_and_analysis?: {
advanced_security?: { status?: string; [k: string]: unknown };
secret_scanning?: { status?: string; [k: string]: unknown };
secret_scanning_push_protection?: {
status?: string;
[k: string]: unknown;
};
[k: string]: unknown;
};
squash_merge_commit_message?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK";
squash_merge_commit_title?: "PR_TITLE" | "COMMIT_OR_PR_TITLE";
use_squash_pr_title_as_default?: boolean;
visibility?: "public" | "private";
web_commit_signoff_required?: boolean;
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}`);
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