type Github = {
token: string;
};
/**
* Update information about a GitHub Pages site
* Updates information for a GitHub Pages site. For more information, see "About GitHub Pages.
To use this endpoint, you must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. A token with the `repo` scope or Pages write permission is required. GitHub Apps must have the `administration:write` and `pages:write` permissions.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: { [k: string]: unknown } & {
build_type?: "legacy" | "workflow";
cname?: string;
https_enforced?: boolean;
source?:
| ("gh-pages" | "master" | "master /docs")
| { branch: string; path: "/" | "/docs"; [k: string]: unknown };
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/pages`);
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.text();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Update information about a GitHub Pages site
* Updates information for a GitHub Pages site. For more information, see "About GitHub Pages.
To use this endpoint, you must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. A token with the `repo` scope or Pages write permission is required. GitHub Apps must have the `administration:write` and `pages:write` permissions.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: { [k: string]: unknown } & {
build_type?: "legacy" | "workflow";
cname?: string;
https_enforced?: boolean;
source?:
| ("gh-pages" | "master" | "master /docs")
| { branch: string; path: "/" | "/docs"; [k: string]: unknown };
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/pages`);
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.text();
}
Submitted by hugo697 872 days ago
type Github = {
token: string;
};
/**
* Update information about a GitHub Pages site
* Updates information for a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages).
To use this endpoint, you must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. A token with the `repo` scope or Pages write permission is required. GitHub Apps must have the `administration:write` and `pages:write` permissions.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: { [k: string]: unknown } & {
build_type?: "legacy" | "workflow";
cname?: string;
https_enforced?: boolean;
source?:
| ("gh-pages" | "master" | "master /docs")
| { branch: string; path: "/" | "/docs"; [k: string]: unknown };
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/pages`);
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.text();
}
Submitted by hugo697 927 days ago