type Github = {
token: string;
};
/**
* Create a GitHub Pages site
* Configures 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";
source?: { 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: "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 360 days ago
type Github = {
token: string;
};
/**
* Create a GitHub Pages site
* Configures 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";
source?: { 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: "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 408 days ago
type Github = {
token: string;
};
/**
* Create a GitHub Pages site
* Configures a GitHub Pages site.
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";
source?: { 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: "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 409 days ago
type Github = {
token: string;
};
/**
* Create a GitHub Pages site
* Configures 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";
source?: { 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: "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 414 days ago