0

Create a changelog entry

by
Published Oct 17, 2025

Create a new changelog entry in your ReadMe project.

Script readme Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create a changelog entry
4
 * Create a new changelog entry in your ReadMe project.
5
 */
6
export async function main(auth: RT.Readme, body: Body) {
7
	const url = new URL(`https://api.readme.com/v2/changelogs`)
8

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

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

31
export interface Body {
32
	author?: {
33
		id?: string
34
	}
35
	content?: {
36
		body?: string
37
	}
38
	/**
39
	 * An ISO 8601 formatted date for when the changelog was created.
40
	 */
41
	created_at?: string
42
	metadata?: {
43
		description?: string
44
		image?: {
45
			uri?: string
46
			url?: string
47
		}
48
		keywords?: string
49
		title?: string
50
	}
51
	privacy?: {
52
		/**
53
		 * The visibility of this changelog.
54
		 */
55
		view?: 'public' | 'anyone_with_link'
56
	}
57
	slug?: string
58
	title: string
59
	/**
60
	 * The type of changelog that this is.
61
	 */
62
	type?: 'none' | 'added' | 'fixed' | 'improved' | 'deprecated' | 'removed'
63
}
64