update history of a script

Script windmill Verified

by hugo697 ยท 3/6/2024

The script

Submitted by hugo697 Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * update history of a script
3
 *
4
 */
5
export async function main(
6
  workspace: string,
7
  hash: string,
8
  path: string,
9
  body: { deployment_msg?: string; [k: string]: unknown }
10
) {
11
  const url = new URL(
12
    `${BASE_URL}/api/w/${workspace}/scripts/history_update/h/${hash}/p/${path}`
13
  );
14

15
  const response = await fetch(url, {
16
    method: "POST",
17
    headers: {
18
      "Content-Type": "application/json",
19
      Authorization: "Bearer " + WM_TOKEN,
20
    },
21
    body: JSON.stringify(body),
22
  });
23
  if (!response.ok) {
24
    const text = await response.text();
25
    throw new Error(`${response.status} ${text}`);
26
  }
27
  return await response.text();
28
}
29