Edits history of script submission #20148 for ' Create a deploy (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Create a deploy
     * Create a deploy for a given release.
     */
    export async function main(auth: RT.Sentry, version: string, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/releases/${version}/deploys/`
    	)
    
    	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.
     */
    
    export interface Body {
    	/**
    	 * The environment you're deploying to
    	 */
    	environment: string
    	/**
    	 * The optional name of the deploy
    	 */
    	name?: string
    	/**
    	 * The optional URL that points to the deploy
    	 */
    	url?: string
    	/**
    	 * An optional date that indicates when the deploy started
    	 */
    	dateStarted?: string
    	/**
    	 * An optional date that indicates when the deploy ended. If not provided, the current time is used.
    	 */
    	dateFinished?: string
    	/**
    	 * The optional list of project slugs to create a deploy within. If not provided, deploys are created for all of the release's projects.
    	 */
    	projects?: string[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago