1 | |
2 | |
3 | * Start seer issue fix |
4 | * Trigger a Seer Issue Fix run for a specific issue. |
5 |
|
6 | The issue fix process can: |
7 | - Identify the root cause of the issue |
8 | - Propose a solution |
9 | - Generate code changes |
10 | - Create a pull request with the fix |
11 |
|
12 | The process runs asynchronously, and you can get the state using the GET endpoint. |
13 | */ |
14 | export async function main(auth: RT.Sentry, issue_id: string, body: Body) { |
15 | const url = new URL( |
16 | `https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/issues/${issue_id}/autofix/` |
17 | ) |
18 |
|
19 | const response = await fetch(url, { |
20 | method: 'POST', |
21 | headers: { |
22 | 'Content-Type': 'application/json', |
23 | Authorization: 'Bearer ' + auth.token |
24 | }, |
25 | body: JSON.stringify(body) |
26 | }) |
27 | if (!response.ok) { |
28 | const text = await response.text() |
29 | throw new Error(`${response.status} ${text}`) |
30 | } |
31 | return await response.json() |
32 | } |
33 |
|
34 | |
35 | |
36 | * This file was automatically generated by json-schema-to-typescript. |
37 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
38 | * and run json-schema-to-typescript to regenerate this file. |
39 | */ |
40 |
|
41 | |
42 | * Allows parameters to be defined in snake case, but passed as camel case. |
43 | * |
44 | * Errors are output in camel case. |
45 | */ |
46 | export interface Body { |
47 | |
48 | * Run issue fix on a specific event. If not provided, the recommended event for the issue will be used. |
49 | */ |
50 | event_id?: string |
51 | |
52 | * Optional custom instruction to guide the issue fix process. |
53 | */ |
54 | instruction?: string |
55 | |
56 | * URL of a pull request where the issue fix should add comments. |
57 | */ |
58 | pr_to_comment_on_url?: string |
59 | |
60 | * Where the issue fix process should stop. If not provided, will run to root cause. |
61 | * |
62 | * * `root_cause` |
63 | * * `solution` |
64 | * * `code_changes` |
65 | * * `open_pr` |
66 | */ |
67 | stopping_point?: 'root_cause' | 'solution' | 'code_changes' | 'open_pr' |
68 | [k: string]: unknown |
69 | } |
70 |
|