export type GetApiReposOwnerRepoActionsRunsRunIdLogsArgs = {owner: string, repo: string, run_id: number}; export type GetApiReposOwnerRepoActionsRunsRunIdLogsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download workflow run logs * * GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs */ export const getApiReposOwnerRepoActionsRunsRunIdLogs = async (args: GetApiReposOwnerRepoActionsRunsRunIdLogsArgs, options?: GetApiReposOwnerRepoActionsRunsRunIdLogsOptions) => { const {baseUrl = "https://api.github.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/repos/${encodeURIComponent(String(args.owner))}/${encodeURIComponent(String(args.repo))}/actions/runs/${encodeURIComponent(String(args.run_id))}/logs${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };