Skip to content

Commit 6428774

Browse files
[ci] release (#1835)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## braintrust@3.9.0 ### Minor Changes - [#1824](#1824) [`c980e07`](c980e07) Thanks [@lforst](https://github.com/lforst)! - feat: Add reranking instrumentation for AI SDK and Openrouter SDK - [#1738](#1738) [`25d25d5`](25d25d5) Thanks [@AbhiPrasad](https://github.com/AbhiPrasad)! - - feat: Add instrumentation for @huggingface/inference ([#1807](#1807)) - feat: Add cohere-ai instrumentation ([#1781](#1781)) - fix: Capture anthropic server tool use inputs for streaming APIs ([#1776](#1776)) - feat: Capture grounding metadata for Google GenAI ([#1773](#1773)) - fix(claude-agent-sdk): Don't drop tool spans for spawning subagents ([#1779](#1779)) - feat: Track server tool use metrics for anthropic SDK ([#1772](#1772)) - fix(openai): Collect logprob and refulsals output for streaming APIs ([#1774](#1774)) - perf: Remove zod from deepCopyEvent ([#1796](#1796)) - fix(test): Double timeout for slow OpenAI API tests ([#1794](#1794)) - feat(claude-agent-sdk): Improve task lifecycle and lifecycle details ([#1777](#1777)) - ci(deps): bump actions/github-script from 8.0.0 to 9.0.0 ([#1783](#1783)) - ci(deps): bump docker/setup-buildx-action from 3.12.0 to 4.0.0 ([#1782](#1782)) - chore: Don't use environment (ie. github deployments) for canary tests ([#1775](#1775)) - chore: Make dependabot less annoying ([#1778](#1778)) - fix(auto-instrumentation): Upgrade @apm-js-collab/code-transformer to v0.12.0 ([#1708](#1708)) - fix(auto-instrumentation): Use sync channel for AI SDK CJS streamText/streamObject in v4+ ([#1768](#1768)) - fix: Give AI SDK top-level api spans type function ([#1769](#1769)) - [#1814](#1814) [`d9b9923`](d9b9923) Thanks [@lforst](https://github.com/lforst)! - - feat: Add per-input trialCount support to Eval() - [#1821](#1821) [`1b5de11`](1b5de11) Thanks [@lforst](https://github.com/lforst)! - feat: Instrument Google GenAI embedContent for text ### Patch Changes - [#1825](#1825) [`f389036`](f389036) Thanks [@lforst](https://github.com/lforst)! - fix(ai-sdk): Restore prompt cache metrics - [#1813](#1813) [`2434a0e`](2434a0e) Thanks [@lforst](https://github.com/lforst)! - fix(openai-agents): End child spans on trace end - [#1836](#1836) [`5581357`](5581357) Thanks [@stretpjc](https://github.com/stretpjc)! - feat: Add x-bt-use-gateway header to allowed CORS headers --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Luca Forstner <luca.forstner@gmail.com>
1 parent d5f7ac2 commit 6428774

16 files changed

+318
-61
lines changed

.changeset/changelog.cjs

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
const {
2+
getInfo,
3+
getInfoFromPullRequest,
4+
} = require("@changesets/get-github-info");
5+
const { config } = require("dotenv");
6+
7+
config({ quiet: true });
8+
9+
function readEnv() {
10+
return {
11+
githubServerUrl: process.env.GITHUB_SERVER_URL || "https://github.com",
12+
githubToken: process.env.GITHUB_TOKEN || "",
13+
};
14+
}
15+
16+
function getIgnoredAuthors(options) {
17+
return new Set(options.ignoredAuthors.map((author) => author.toLowerCase()));
18+
}
19+
20+
function normalizeSummary(summary) {
21+
let prFromSummary;
22+
let commitFromSummary;
23+
const usersFromSummary = [];
24+
25+
const text = summary
26+
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/gim, (_, pr) => {
27+
const parsed = Number(pr);
28+
if (!Number.isNaN(parsed)) {
29+
prFromSummary = parsed;
30+
}
31+
return "";
32+
})
33+
.replace(/^\s*commit:\s*([^\s]+)/gim, (_, commit) => {
34+
commitFromSummary = commit;
35+
return "";
36+
})
37+
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
38+
usersFromSummary.push(user);
39+
return "";
40+
})
41+
.split("\n")
42+
.map((line) => line.trim())
43+
.filter(Boolean)
44+
.join(" ");
45+
46+
return { text, prFromSummary, commitFromSummary, usersFromSummary };
47+
}
48+
49+
function uniqueUsers(users) {
50+
const seen = new Set();
51+
const result = [];
52+
53+
for (const user of users) {
54+
const normalized = user.toLowerCase();
55+
if (seen.has(normalized)) {
56+
continue;
57+
}
58+
59+
seen.add(normalized);
60+
result.push(normalized);
61+
}
62+
63+
return result;
64+
}
65+
66+
function formatThanks(users, ignoredAuthors) {
67+
const externalUsers = uniqueUsers(users).filter(
68+
(user) => !ignoredAuthors.has(user),
69+
);
70+
71+
if (externalUsers.length === 0) {
72+
return "";
73+
}
74+
75+
return ` Thanks ${externalUsers.map((user) => `@${user}`).join(", ")}!`;
76+
}
77+
78+
async function readGithubInfo({
79+
repo,
80+
prFromSummary,
81+
commitFromSummary,
82+
fallbackCommit,
83+
canQueryGithub,
84+
}) {
85+
if (prFromSummary !== undefined) {
86+
if (!canQueryGithub) {
87+
return { pull: prFromSummary, user: null };
88+
}
89+
90+
const info = await getInfoFromPullRequest({ repo, pull: prFromSummary });
91+
return { pull: prFromSummary, user: info.user };
92+
}
93+
94+
const commit = commitFromSummary || fallbackCommit;
95+
if (!commit || !canQueryGithub) {
96+
return { pull: null, user: null };
97+
}
98+
99+
const info = await getInfo({ repo, commit });
100+
return { pull: info.pull, user: info.user };
101+
}
102+
103+
const changelogFunctions = {
104+
async getReleaseLine(changeset, _type, options) {
105+
if (!options?.repo) {
106+
throw new Error(
107+
'Please provide a repo to this changelog generator like this:\n"changelog": ["./.changeset/changelog.cjs", { "repo": "org/repo" }]',
108+
);
109+
}
110+
111+
const { githubServerUrl, githubToken } = readEnv();
112+
const ignoredAuthors = getIgnoredAuthors(options);
113+
const { text, prFromSummary, commitFromSummary, usersFromSummary } =
114+
normalizeSummary(changeset.summary);
115+
116+
const info = await readGithubInfo({
117+
repo: options.repo,
118+
prFromSummary,
119+
commitFromSummary,
120+
fallbackCommit: changeset.commit,
121+
canQueryGithub: Boolean(githubToken),
122+
});
123+
124+
const users = usersFromSummary.length
125+
? usersFromSummary
126+
: info.user
127+
? [info.user]
128+
: [];
129+
const thanks = formatThanks(users, ignoredAuthors);
130+
const pullUrl = info.pull
131+
? ` (${githubServerUrl}/${options.repo}/pull/${info.pull})`
132+
: "";
133+
134+
return `- ${text}${thanks}${pullUrl}`;
135+
},
136+
137+
async getDependencyReleaseLine(_changesets, dependenciesUpdated) {
138+
if (dependenciesUpdated.length === 0) {
139+
return "";
140+
}
141+
142+
const dependencies = dependenciesUpdated
143+
.map((dependency) => `${dependency.name}@${dependency.newVersion}`)
144+
.sort((left, right) => left.localeCompare(right));
145+
146+
return `- Updated dependencies: ${dependencies.join(", ")}`;
147+
},
148+
};
149+
150+
module.exports = changelogFunctions;

.changeset/config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config/schema.json",
33
"changelog": [
4-
"@changesets/changelog-github",
4+
"./.changeset/changelog.cjs",
55
{
6-
"repo": "braintrustdata/braintrust-sdk-javascript"
6+
"repo": "braintrustdata/braintrust-sdk-javascript",
7+
"ignoredAuthors": ["abhiprasad", "lforst", "qard"]
78
}
89
],
910
"commit": false,

.changeset/fluffy-games-build.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/grumpy-mangos-drum.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/lazy-dots-send.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/little-webs-hang.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

.changeset/ninety-windows-act.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/slimy-bars-cheer.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/strong-walls-serve.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/publish-js-sdk.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
with:
194194
mode: prerelease
195195
checkout_ref: ${{ inputs.branch || github.ref_name }}
196-
version_command: pnpm exec changeset version --snapshot rc
196+
version_command: pnpm run changeset:version -- --snapshot rc
197197
publish_enabled: true
198198
publish_command: pnpm exec changeset publish --tag rc --no-git-tag
199199
slack_text: "🧪 JavaScript prerelease snapshots published"
@@ -213,7 +213,7 @@ jobs:
213213
with:
214214
mode: canary
215215
checkout_ref: ${{ github.ref_name }}
216-
version_command: pnpm exec changeset version --snapshot canary
216+
version_command: pnpm run changeset:version -- --snapshot canary
217217
publish_enabled: true
218218
publish_command: pnpm exec changeset publish --tag canary --no-git-tag
219219
run_canary_check: true
@@ -234,7 +234,7 @@ jobs:
234234
with:
235235
mode: dry-run-canary
236236
checkout_ref: ${{ inputs.ref || 'main' }}
237-
version_command: pnpm exec changeset version --snapshot canary
237+
version_command: pnpm run changeset:version -- --snapshot canary
238238
artifact_dir: artifacts/dry-run-canary
239239
artifact_name: canary-dry-run-${{ github.run_id }}
240240

@@ -249,7 +249,7 @@ jobs:
249249
with:
250250
mode: dry-run-stable
251251
checkout_ref: ${{ inputs.ref || 'main' }}
252-
version_command: pnpm exec changeset version && pnpm install --lockfile-only
252+
version_command: pnpm run changeset:version:lockfile
253253
artifact_dir: artifacts/dry-run-stable
254254
artifact_name: stable-dry-run-${{ github.run_id }}
255255

@@ -264,7 +264,7 @@ jobs:
264264
with:
265265
mode: dry-run-prerelease
266266
checkout_ref: ${{ inputs.branch || github.ref_name }}
267-
version_command: pnpm exec changeset version --snapshot rc
267+
version_command: pnpm run changeset:version -- --snapshot rc
268268
artifact_dir: artifacts/dry-run-prerelease
269269
artifact_name: prerelease-dry-run-${{ github.run_id }}
270270

0 commit comments

Comments
 (0)