Skip to content

Commit 9d7128c

Browse files
cliffhallclaude
andcommitted
fix(interface-diff): drop target_ref; keep both streams in errors (#4860)
Copilot round 7 on #4975: - Remove the dispatch `target_ref` input: a target that predates the script has no `npm run interface-diff`, so the run failed. The head is the branch chosen in "Use workflow from". - A failed base install or build now reports the tail of both stdout and stderr, so tsc diagnostics are not lost behind an npm footer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent ff19179 commit 9d7128c

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎.github/workflows/everything-mcp-diff.yml‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,16 @@ on:
5757
# 2024, and no release since has used them.
5858
release:
5959
types: [published]
60-
# Manual trigger for comparing any two refs (commits, tags, branches)
60+
# Manual trigger: the branch chosen in "Use workflow from" is the head, and
61+
# `compare_ref` any base. #3260 also took a `target_ref`, but a target that
62+
# predates the interface-diff script has no `npm run interface-diff` to run,
63+
# so the head is the dispatched branch instead.
6164
workflow_dispatch:
6265
inputs:
6366
compare_ref:
6467
description: "Base ref to compare against (commit SHA, tag, or branch; defaults to the merge-base with v2/main)"
6568
required: false
6669
default: ""
67-
target_ref:
68-
description: "Target ref to compare (defaults to the ref the workflow runs on)"
69-
required: false
70-
default: ""
7170

7271
permissions:
7372
contents: read
@@ -95,7 +94,7 @@ jobs:
9594
fetch-depth: 0
9695
# The event's own commit (the merge commit for a PR), not a branch
9796
# ref that a later push could move before this step runs.
98-
ref: ${{ inputs.target_ref || github.sha }}
97+
ref: ${{ github.sha }}
9998
persist-credentials: false
10099

101100
- uses: actions/setup-node@v7

‎scripts/interface-diff.mjs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ export function renderReport(verdict, { base, head }) {
203203
return lines.join("\n");
204204
}
205205

206+
/** The last lines of a stream, for an error message; empty stays empty. */
207+
const tail = (text) => {
208+
const lines = (text ?? "").trim();
209+
return lines ? `${lines.split("\n").slice(-25).join("\n")}\n` : "";
210+
};
211+
206212
/**
207213
* Run a command to completion; throw with its output when it fails. Only
208214
* `npm` needs a shell, and only on Windows (it is a `.cmd` shim there); its
@@ -220,7 +226,7 @@ function run(command, args, cwd, env) {
220226
if (res.error) throw res.error;
221227
if (res.status !== 0)
222228
throw new Error(
223-
`\`${command} ${args.join(" ")}\` exited ${res.status}:\n${(res.stderr || res.stdout).trim().split("\n").slice(-25).join("\n")}`,
229+
`\`${command} ${args.join(" ")}\` exited ${res.status}:\n${tail(res.stdout)}${tail(res.stderr)}`,
224230
);
225231
return res.stdout;
226232
}

0 commit comments

Comments
 (0)