type Github = {
token: string;
};
/**
* Re-run a job from a workflow run
* Re-run a job and its dependent jobs in a workflow run. 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,
job_id: string,
body: { enable_debug_logging?: boolean; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/actions/jobs/${job_id}/rerun`
);
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 367 days ago
type Github = {
token: string;
};
/**
* Re-run a job from a workflow run
* Re-run a job and its dependent jobs in a workflow run. 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,
job_id: string,
body: { enable_debug_logging?: boolean; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/actions/jobs/${job_id}/rerun`
);
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 927 days ago