ci: check out the repository properly in the gitsplit workflow - #722
Open
Spomky wants to merge 1 commit into
Open
ci: check out the repository properly in the gitsplit workflow#722Spomky wants to merge 1 commit into
Spomky wants to merge 1 commit into
Conversation
The step cloned the repository by hand into a path unrelated to the workspace, and always landed on the default branch. gitsplit therefore applied the .gitsplit.yml of that branch to every reference it walks, whatever ref had actually been pushed. A split declared for the next minor then governed the older branches too, and a target repository that did not exist yet aborted the publication of every package. actions/checkout gives the ref that triggered the run, with the full history gitsplit needs to walk the branches and tags. Credentials are not persisted: the container reads a public repository and only needs GITSPLIT_TOKEN for the targets it pushes to.
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.
Problem
The checkout step cloned the repository by hand:
Two consequences.
It clones into a path that has nothing to do with
github.workspace, so the whole thing only holds together because thedocker runmount repeats the same hardcoded path.More importantly,
git clonewith no-balways lands on the default branch, whatever ref actually triggered the run. gitsplit reads a single.gitsplit.yml, the one in the working copy, and applies it to every branch and tag matching itsoriginspatterns. So the default branch's config governed every reference, and the per-branch copies of the file were never read.That is what turned #714 into a day-long outage:
src/Unsecuredandsrc/Rsa15were declared on 4.3.x before their repositories existed, and since 4.3.x is the default branch, the run aborted on the missing remote before ever reaching the 4.2.x branch or the 4.2.2 tag.web-token/jwt-librarystayed published at 4.2.1, cappingbrick/mathat^0.19for every downstream project, while the config on 4.2.x was perfectly correct and simply never read.Change
actions/checkout@v5, the versionci.ymlalready uses, with:fetch-depth: 0, because gitsplit walks every branch and tag and a shallow clone only holds the triggering refpersist-credentials: false, so the repository credentials are not handed to a third-party container image; it reads a public repository and only needsGITSPLIT_TOKENfor the targets it pushes toThe mount becomes
${{ github.workspace }}instead of the hardcoded path, and a header comment records why the checkout has to look like this.The behaviour change worth stating plainly:
.gitsplit.ymlnow comes from the ref being pushed rather than from the default branch. A push to 4.2.x is governed by 4.2.x's config, a push to 4.3.x by 4.3.x's. A prefix that is absent from a reference is walked without an error, assrc/Experimentalalready is on the 3.1.x tags, so a split declared on a newer branch still costs nothing on the older ones.Note
Targeting 4.2.x, the last released minor.
pushevents run the workflow from the ref being pushed, so 4.3.x only picks this up through the usual merge-up.