1 | |
2 | |
3 | * Create a deploy |
4 | * Create a deploy for a given release. |
5 | */ |
6 | export async function main(auth: RT.Sentry, version: string, body: Body) { |
7 | const url = new URL( |
8 | `https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/releases/${version}/deploys/` |
9 | ) |
10 |
|
11 | const response = await fetch(url, { |
12 | method: 'POST', |
13 | headers: { |
14 | 'Content-Type': 'application/json', |
15 | Authorization: 'Bearer ' + auth.token |
16 | }, |
17 | body: JSON.stringify(body) |
18 | }) |
19 | if (!response.ok) { |
20 | const text = await response.text() |
21 | throw new Error(`${response.status} ${text}`) |
22 | } |
23 | return await response.json() |
24 | } |
25 |
|
26 | |
27 | |
28 | * This file was automatically generated by json-schema-to-typescript. |
29 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
30 | * and run json-schema-to-typescript to regenerate this file. |
31 | */ |
32 |
|
33 | export interface Body { |
34 | |
35 | * The environment you're deploying to |
36 | */ |
37 | environment: string |
38 | |
39 | * The optional name of the deploy |
40 | */ |
41 | name?: string |
42 | |
43 | * The optional URL that points to the deploy |
44 | */ |
45 | url?: string |
46 | |
47 | * An optional date that indicates when the deploy started |
48 | */ |
49 | dateStarted?: string |
50 | |
51 | * An optional date that indicates when the deploy ended. If not provided, the current time is used. |
52 | */ |
53 | dateFinished?: string |
54 | |
55 | * The optional list of project slugs to create a deploy within. If not provided, deploys are created for all of the release's projects. |
56 | */ |
57 | projects?: string[] |
58 | [k: string]: unknown |
59 | } |
60 |
|