type Github = {
token: string;
};
/**
* Set the level of access for workflows outside of the repository
* Sets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: { access_level: "none" | "user" | "organization"; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/actions/permissions/access`
);
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;
};
/**
* Set the level of access for workflows outside of the repository
* Sets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
body: { access_level: "none" | "user" | "organization"; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/actions/permissions/access`
);
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