Edits history of script submission #20326 for ' Update an organizations release (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update an organizations release
     * Update a release. This can change some metadata associated with
    the release (the ref, url, and dates).
     */
    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}/`
    	)
    
    	const response = await fetch(url, {
    		method: 'PUT',
    		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 {
    	/**
    	 * An optional commit reference. This is useful if a tagged version has been provided.
    	 */
    	ref?: string
    	/**
    	 * A URL that points to the release. For instance, this can be the path to an online interface to the source code, such as a GitHub URL.
    	 */
    	url?: string
    	/**
    	 * An optional date that indicates when the release went live.  If not provided the current time is used.
    	 */
    	dateReleased?: string
    	/**
    	 * An optional list of commit data to be associated.
    	 */
    	commits?: {
    		id: string
    		repository?: string
    		message?: string
    		author_name?: string
    		author_email?: string
    		timestamp?: string
    		patch_set?: {
    			path: string
    			type: string
    			[k: string]: unknown
    		}[]
    		[k: string]: unknown
    	}[]
    	/**
    	 * An optional way to indicate the start and end commits for each repository included in a release. Head commits must include parameters ``repository`` and ``commit`` (the HEAD SHA). For GitLab repositories, please use the Group name instead of the slug. They can optionally include ``previousCommit`` (the SHA of the HEAD of the previous release), which should be specified if this is the first time you've sent commit data.
    	 */
    	refs?: {
    		commit: string
    		repository: string
    		previousCommit?: string
    		[k: string]: unknown
    	}[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago