0

Update an organizations release

by
Published Oct 17, 2025

Update a release. This can change some metadata associated with the release (the ref, url, and dates).

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update an organizations release
4
 * Update a release. This can change some metadata associated with
5
the release (the ref, url, and dates).
6
 */
7
export async function main(auth: RT.Sentry, version: string, body: Body) {
8
	const url = new URL(
9
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/releases/${version}/`
10
	)
11

12
	const response = await fetch(url, {
13
		method: 'PUT',
14
		headers: {
15
			'Content-Type': 'application/json',
16
			Authorization: 'Bearer ' + auth.token
17
		},
18
		body: JSON.stringify(body)
19
	})
20
	if (!response.ok) {
21
		const text = await response.text()
22
		throw new Error(`${response.status} ${text}`)
23
	}
24
	return await response.json()
25
}
26

27
/* eslint-disable */
28
/**
29
 * This file was automatically generated by json-schema-to-typescript.
30
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
31
 * and run json-schema-to-typescript to regenerate this file.
32
 */
33

34
export interface Body {
35
	/**
36
	 * An optional commit reference. This is useful if a tagged version has been provided.
37
	 */
38
	ref?: string
39
	/**
40
	 * 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.
41
	 */
42
	url?: string
43
	/**
44
	 * An optional date that indicates when the release went live.  If not provided the current time is used.
45
	 */
46
	dateReleased?: string
47
	/**
48
	 * An optional list of commit data to be associated.
49
	 */
50
	commits?: {
51
		id: string
52
		repository?: string
53
		message?: string
54
		author_name?: string
55
		author_email?: string
56
		timestamp?: string
57
		patch_set?: {
58
			path: string
59
			type: string
60
			[k: string]: unknown
61
		}[]
62
		[k: string]: unknown
63
	}[]
64
	/**
65
	 * 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.
66
	 */
67
	refs?: {
68
		commit: string
69
		repository: string
70
		previousCommit?: string
71
		[k: string]: unknown
72
	}[]
73
	[k: string]: unknown
74
}
75