Skip to content

Commit 1518cf6

Browse files
kraenhansenclaude
andcommitted
[DX-1319] Add the packages type-surface workflow
Single job that builds head and the merge-base (git worktree) once with turbo, then runs the dts-breaking-changes action in workspace mode: the action discovers every package's public type entrypoints and reports them in one PR comment. Major changesets are detected and passed as `allow-breaking-packages`. `@elevenlabs/types` is type-only, so it ships dts-breaking-changes.json with `compareTypeOnlyExports: true`. The engine, discovery, and multi-surface action live in the base PR (#917). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e3ecb10 commit 1518cf6

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/type-surface.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: type surface
2+
3+
# Warns when a PR introduces a breaking change to any package's public type
4+
# surface, comparing each package's built types against the merge-base and
5+
# reporting them in a single PR comment. A consumer-breaking change fails the
6+
# check; it is acknowledged (downgraded to a warning) by the `breaking` PR label
7+
# OR a `major` changeset for that package. labeled/unlabeled re-run so toggling
8+
# the label clears/raises the check.
9+
10+
on:
11+
pull_request:
12+
types: [opened, synchronize, reopened, labeled, unlabeled]
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
concurrency:
19+
group: type-surface-${{ github.event.pull_request.number }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
type-surface:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout head
27+
uses: actions/checkout@v6
28+
with:
29+
ref: ${{ github.event.pull_request.head.sha }}
30+
fetch-depth: 0
31+
32+
- name: Set up pnpm
33+
uses: pnpm/action-setup@v4
34+
35+
- name: Set up node
36+
uses: actions/setup-node@v6
37+
with:
38+
node-version: lts/Krypton
39+
40+
- name: Build head
41+
run: |
42+
pnpm install --frozen-lockfile
43+
pnpm build
44+
45+
- name: Build merge-base in a worktree
46+
id: base
47+
run: |
48+
set -euo pipefail
49+
git fetch --no-tags origin "${{ github.event.pull_request.base.ref }}"
50+
BASE_SHA="$(git merge-base FETCH_HEAD HEAD)"
51+
echo "sha=$BASE_SHA" >> "$GITHUB_OUTPUT"
52+
git worktree add --detach "$RUNNER_TEMP/base" "$BASE_SHA"
53+
(cd "$RUNNER_TEMP/base" && pnpm install --frozen-lockfile && pnpm build)
54+
55+
- name: Detect major changesets
56+
id: changeset
57+
run: |
58+
set -euo pipefail
59+
MAJORS=$(node -e '
60+
const fs = require("fs"), p = require("path");
61+
const s = new Set();
62+
if (fs.existsSync(".changeset")) {
63+
for (const f of fs.readdirSync(".changeset")) {
64+
if (!f.endsWith(".md")) continue;
65+
const t = fs.readFileSync(p.join(".changeset", f), "utf8");
66+
for (const m of t.matchAll(/["\x27]([^"\x27]+)["\x27]\s*:\s*major/g)) s.add(m[1]);
67+
}
68+
}
69+
process.stdout.write([...s].join(","));
70+
')
71+
echo "majors=$MAJORS" >> "$GITHUB_OUTPUT"
72+
echo "Major changesets: ${MAJORS:-(none)}"
73+
74+
- name: Check type surfaces
75+
uses: ./.github/actions/dts-breaking-changes
76+
with:
77+
base-root: ${{ runner.temp }}/base
78+
head-root: ${{ github.workspace }}
79+
allow-breaking-packages: ${{ steps.changeset.outputs.majors }}
80+
base-sha: ${{ steps.base.outputs.sha }}
81+
title: packages
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"compareTypeOnlyExports": true
3+
}

0 commit comments

Comments
 (0)