Repository navigation
Follow what the pull request itself changes, not the last release - #119
Merged
Merged
Conversation
The check, the labels and the comment follow the pull request's committed API against its base branch, framework by framework, so a pull request is not held back by a breaking change main already has or by the pull requests below it in a stack. The new api-diff command compares two directories of committed .api files; the action runs it for the pull request and for each open pull request below it. The comparison with the last release stays in the comment, collapsed, with the pull requests that introduced its changes, and a change that is the same in every target framework is listed once. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Mpdreamz
added a commit
to elastic/elastic-transport-net
that referenced
this pull request
Nov 25, 2026
… makes (#234) The API check now fails a pull request only for a breaking change the pull request itself makes, not for one that `main`, or a pull request below it in a stack, already has. **Prompt summary:** The API comments on the stacked 2.0 pull requests listed breaking changes that the pull requests did not touch, and would turn every pull request red whenever `main` has an unreleased breaking change. The owner asked for the check to follow only what a pull request itself changes, and for the pull requests that introduced the changes to be listed. ## Why Since #232 the action compared each build with the latest release on nuget.org. A pull request in the middle of a stack therefore showed everything below it: #227 changes nothing in the public API and still listed 32 breaking changes and failed the check. ## What #### assembly-differ 1.5.0 The pinned action, the `version:` input and the tool in `dotnet-tools.json` go from 1.4.0 to 1.5.1 ([nullean/assembly-differ#119](nullean/assembly-differ#119), and the fix of 1.5.0 in [#120](nullean/assembly-differ#120)). 1.5.0 fetched the base branch into the workflow's own checkout with `--depth=1`, which cut the history that MinVer reads in `validatepackages`; 1.5.1 fetches into a repository of its own. With `api-files: api`, the action now compares a pull request's committed `api/` with its base branch's, target framework by target framework, and the check, the release label and `--fail-on` follow that. The comparison with the latest release stays in the comment, collapsed and marked as information, with a table of the pull requests below this one that introduced the changes. A change that is the same in every framework is listed once. No workflow change is needed: the new step reads the base branch and the open pull requests of a stack with the token the job already has. **Out of scope:** the 2.0 stack picks this up once it is rebased onto `main`: a pull request runs the workflow of its base branch, so until then the stack pull requests run the old one. ## Verify ```bash dotnet tool restore ./build.sh verifyapi ``` On this pull request the comment compares with `main` and lists both libraries as having no changes. I ran the steps of the new action on the real stack beforehand: #227 gets `None` and passes, and #220, which does break the API, gets the `breaking` label and fails. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The check, the release label and the comment now follow what the pull request itself changes in the committed API, compared with its base branch framework by framework, so a pull request no longer turns red because
main, or a pull request below it in a stack, has a breaking change.Prompt summary: On the Elastic.Transport pull requests, a stacked pull request that changed nothing in the public API listed 32 breaking changes and failed the check, because the action compared with the latest release. The owner asked for the delta against the base branch, for the PRs that introduced the changes to be listed, for the check to fail only on a change the pull request itself makes, and for target frameworks to be reported better.
Why
The action compared the build with the latest release on nuget.org. That answers which version bump a branch needs, not what a pull request changes. Every pull request cumulated all the changes below it: in a stack of eleven, the last nine showed the same 32 breaking changes, and a breaking change on
mainthat is not released yet would fail every pull request until it is. The comparison also picks one target framework of the release for the newest framework of the build, so anet11.0build was compared with another framework's assembly and reported changes that the net10.0 API does not have.What
api-diff
A new command,
api-diff <old> <new>, compares two directories of committed.apifiles with the comparisonapi --verifyuses, one API against the API of the same name, so each target framework is compared with itself. An API only one side has is added (minor) or removed (major); an API without changes is listed.--format json --outputwrites the shape ofapi-changes.json, so the comment renders it as it does the others, and addsdistinctBreakingChanges: the same change in five frameworks counts once. Nothing is built.The base branch and the stack
With
api-fileson a pull request, a new step in the action exports the committed API of the base branch and compares it with the pull request's. It then walks the open pull requests whose branches the stack is made of, and compares each with what it was based on, from the bottom up. The token only reads.base-comparison: falsegoes back to following the release.The comment
The pull request's own change leads, and the check, the labels and
--fail-onfollow it. The comparison with the last release follows in a collapsed block marked as information, with a table of the pull requests below that introduced changes. In the comment, an assembly's frameworks with the same changes are listed once (Lib (net10.0, net8.0, net462)), and a change only some frameworks have, such as code under#if NET8_0, stands apart with its frameworks. The command gets--base-report,--base-nameand--stack; without them, nothing changes and the comments of the existing tests are byte for byte the same.Breaking: on a pull request with
api-files, the check no longer fails for a breaking change that is in the comparison with the release and not in the pull request's own. Nothing used the action before 1.4.0.Helpsnapshots gainapi-diffand three options.Out of scope: the comparison with the release still compares the newest framework of a project with the closest framework of the release; it is information now, and its framework choice is a separate fix. Without
api-filesthere is no committed API to compare, and the check follows the release.Verify
Following the release again, or listing frameworks one by one, fails the tests. I also ran the steps of
action.ymlas a runner would, with this build and the real GitHub API, on the stack of elastic/elastic-transport-net#219 to #229. #227, which changes nothing in the API, getsNone, ticks for every framework, and exit code 0; its stack table says #220 (7 breaking changes), #221 (22) and #225 (6) introduced the changes since the release. #220 itself gets thebreakinglabel and exit code 4.zizmor --min-severity mediumfinds nothing.🤖 Generated with Claude Code