0

Commit App Rollback

Published Dec 20, 2024

Commit an app rollback. This action permanently applies the rollback and unpins the app to resume new deployments.

Script digitalocean Verified

The script

Submitted by hugo697 Bun
Verified 698 days ago
1
//native
2
type Digitalocean = {
3
  token: string;
4
};
5
/**
6
 * Commit App Rollback
7
 * Commit an app rollback. This action permanently applies the rollback and unpins the app to resume new deployments.
8

9
 */
10
export async function main(auth: Digitalocean, app_id: string) {
11
  const url = new URL(
12
    `https://api.digitalocean.com/v2/apps/${app_id}/rollback/commit`,
13
  );
14

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