Skip to content

Leave the workflow's checkout alone when comparing with the base branch - #120

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/base-step-leaves-the-checkout-alone
Nov 25, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
fix/base-step-leaves-the-checkout-alone

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

The base-branch step of the action no longer changes the workflow's checkout: the commits it compares with are fetched into a repository of its own, so a step after it that reads a version from tags still finds the tags.

Prompt summary: Move the Elastic.Transport repository to assembly-differ 1.5.0. Its pull request failed validatepackages with a version of 0.1.0-canary instead of 1.1.1-canary, and the owner asked to open the pull request, merge it and rebase the stack after.

Why

The step added in 1.5.0 runs git fetch --depth=1 origin <sha> in the workflow's checkout to read the committed API of the base branch. In a checkout that was already complete, which is what fetch-depth: 0, or the git fetch --unshallow --tags that elastic-transport-net runs, gives, that fetch cuts the history behind the commit: it becomes a shallow boundary and its parents are gone. MinVer, which runs in a later step, then sees the base branch tip as the first commit of the repository and no tag: elastic-transport-net's pull request got Commit: 3913365, Height: 1, Version: 0.0.0-canary and validatepackages failed on the version.

What

A repository of its own

The step makes a bare repository under the runner's temp directory and fetches and archives the commits there, with the same token header as before, from the checkout's origin. The workflow's checkout is not touched, and the comparison is the same.

Verify

In a full clone of elastic/elastic-transport-net, at the tip of elastic/elastic-transport-net#227, I ran the base step of main and the base step of this branch, with the real GitHub API, and compared the clone before and after:

1.5.0 step:  history 219 -> 219   shallow: false -> true    delta report written
this branch: history 219 -> 219   shallow: false -> false   delta report written

Nothing in the repository can test the step, which runs on a runner, so this is the check; it fails for the old step, as the failed validatepackages did.

🤖 Generated with Claude Code

The base step fetched the commits it compares with into the workflow's own
checkout with --depth=1. In a checkout that was already complete, that cut
the history of the commits it had, and a step after it that reads the
version from tags, such as MinVer, found none. The commits are fetched
into a repository of their own.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Mpdreamz Mpdreamz added the bug A defect fixed (patch) label Nov 25, 2026
@Mpdreamz
Mpdreamz merged commit ce2ac1d into main Nov 25, 2026
7 checks passed
@Mpdreamz
Mpdreamz deleted the fix/base-step-leaves-the-checkout-alone branch November 25, 2026 19:06
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A defect fixed (patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant