0

Revert App Rollback

by
Published Dec 20, 2024

Revert an app rollback. This action reverts the active rollback by creating a new deployment from the latest app spec prior to the rollback and unpins the app to resume new deployments.

Script digitalocean Verified

The script

Submitted by hugo697 Bun
Verified 536 days ago
1
//native
2
type Digitalocean = {
3
  token: string;
4
};
5
/**
6
 * Revert App Rollback
7
 * Revert an app rollback. This action reverts the active rollback by creating a new deployment from the
8
latest app spec prior to the rollback and unpins the app to resume new deployments.
9

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

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