type Github = {
token: string;
};
/**
* Disable a workflow
* Disables a workflow and sets the `state` of the workflow to `disabled_manually`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
workflow_id: string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/actions/workflows/${workflow_id}/disable`
);
const response = await fetch(url, {
method: "PUT",
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;
};
/**
* Disable a workflow
* Disables a workflow and sets the `state` of the workflow to `disabled_manually`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint.
*/
export async function main(
auth: Github,
owner: string,
repo: string,
workflow_id: string
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/actions/workflows/${workflow_id}/disable`
);
const response = await fetch(url, {
method: "PUT",
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