Edits history of script submission #20300 for ' Start seer issue fix (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Start seer issue fix
     * Trigger a Seer Issue Fix run for a specific issue.
    
    The issue fix process can:
    - Identify the root cause of the issue
    - Propose a solution
    - Generate code changes
    - Create a pull request with the fix
    
    The process runs asynchronously, and you can get the state using the GET endpoint.
     */
    export async function main(auth: RT.Sentry, issue_id: string, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/issues/${issue_id}/autofix/`
    	)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.token
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    
    /* eslint-disable */
    /**
     * This file was automatically generated by json-schema-to-typescript.
     * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
     * and run json-schema-to-typescript to regenerate this file.
     */
    
    /**
     * Allows parameters to be defined in snake case, but passed as camel case.
     *
     * Errors are output in camel case.
     */
    export interface Body {
    	/**
    	 * Run issue fix on a specific event. If not provided, the recommended event for the issue will be used.
    	 */
    	event_id?: string
    	/**
    	 * Optional custom instruction to guide the issue fix process.
    	 */
    	instruction?: string
    	/**
    	 * URL of a pull request where the issue fix should add comments.
    	 */
    	pr_to_comment_on_url?: string
    	/**
    	 * Where the issue fix process should stop. If not provided, will run to root cause.
    	 *
    	 * * `root_cause`
    	 * * `solution`
    	 * * `code_changes`
    	 * * `open_pr`
    	 */
    	stopping_point?: 'root_cause' | 'solution' | 'code_changes' | 'open_pr'
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago