From 5b9a182cdd887265848680e80681a09ae0025226 Mon Sep 17 00:00:00 2001 From: hatayama Date: Sat, 13 Jun 2026 01:59:00 +0900 Subject: [PATCH 1/2] chore: Skip CLI minimum version check on release-please release PRs Release PRs only contain release-please version stamps for cli/contract.json and cli/internal/tools/default-tools.json, but the check classified those stamps as Go CLI changes and failed because the release PR never bumps MINIMUM_REQUIRED_CLI_VERSION. The reminder is meant for human-authored CLI changes, so detect the release-please--branches--* head branch via GITHUB_HEAD_REF and skip. The architecture test harness now always sets GITHUB_HEAD_REF explicitly because CI inherits the real PR head branch into the test process, which would otherwise trigger the new skip path on release PRs themselves. --- ...omment_cli_minimum_version_warning_test.go | 19 +++++++++++++ .../automation/minimum_version_warning.go | 11 ++++++++ .../minimum_version_warning_test.go | 27 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/cli/internal/architecture/comment_cli_minimum_version_warning_test.go b/cli/internal/architecture/comment_cli_minimum_version_warning_test.go index 77367cb70c..2c9ff0399e 100644 --- a/cli/internal/architecture/comment_cli_minimum_version_warning_test.go +++ b/cli/internal/architecture/comment_cli_minimum_version_warning_test.go @@ -26,6 +26,7 @@ type commentScriptOptions struct { Mutation string BaseRef string HeadRef string + HeadBranch string IncludePRNumber bool FailOnWarning bool ExpectFailure bool @@ -134,6 +135,21 @@ func TestCommentCliMinimumVersionWarningIgnoresUnrelatedChanges(t *testing.T) { assertNotContains(t, result.GitHubLog, "PATCH") } +// Verifies that release-please release PRs skip check mode even with Go CLI changes. +func TestCommentCliMinimumVersionWarningSkipsReleasePleaseBranch(t *testing.T) { + result := runCommentScriptCase(t, commentScriptOptions{ + Mutation: "go-cli", + BaseRef: "HEAD^", + HeadBranch: "release-please--branches--v3-beta", + IncludePRNumber: true, + FailOnWarning: true, + }) + + assertContains(t, result.Output, "release-please release PR") + assertNotContains(t, result.GitHubLog, "POST") + assertNotContains(t, result.GitHubLog, "PATCH") +} + // Verifies that non-PR runs stop before calling GitHub issue APIs. func TestCommentCliMinimumVersionWarningSkipsNonPullRequestRuns(t *testing.T) { result := runCommentScriptCase(t, commentScriptOptions{ @@ -190,6 +206,8 @@ func runCommentScript( command := exec.Command(filepath.Join(repositoryRoot(t), commentScriptPath)) command.Dir = repositoryPath + // GITHUB_HEAD_REF is always set explicitly because CI inherits the real PR head + // branch into the test process, which would trigger the release-please skip path. command.Env = append(os.Environ(), "PATH="+mockBinPath+string(os.PathListSeparator)+os.Getenv("PATH"), "GH_LOG="+gitHubLogPath, @@ -197,6 +215,7 @@ func runCommentScript( "GH_EXISTING_COMMENT_ID="+options.ExistingCommentID, "ULOOP_REPOSITORY_ROOT="+repositoryPath, "GITHUB_REPOSITORY=hatayama/unity-cli-loop", + "GITHUB_HEAD_REF="+options.HeadBranch, ) if options.IncludePRNumber { command.Env = append(command.Env, "PR_NUMBER=123") diff --git a/cli/internal/automation/minimum_version_warning.go b/cli/internal/automation/minimum_version_warning.go index c45860dfd9..459bd353b2 100644 --- a/cli/internal/automation/minimum_version_warning.go +++ b/cli/internal/automation/minimum_version_warning.go @@ -25,6 +25,8 @@ Please confirm whether the Unity package can still accept older CLI versions. If Resolved: this PR no longer has Go CLI changes without a ` + "`MINIMUM_REQUIRED_CLI_VERSION`" + ` update. ` goCliPackageRoot = "cli/" + // release-please names its release branches "release-please--branches--". + releasePleaseBranchPrefix = "release-please--" ) var minimumVersionWarningValuePattern = regexp.MustCompile(`MINIMUM_REQUIRED_CLI_VERSION\s*=\s*"([^"]+)"`) @@ -35,6 +37,7 @@ type minimumVersionWarningConfig struct { repository string baseRef string headRef string + headBranch string failOnWarning bool } @@ -49,6 +52,13 @@ func RunMinimumVersionWarning(ctx context.Context, stdout io.Writer, stderr io.W return 0 } + // Release PRs only contain release-please version stamps (cli/contract.json and + // internal/tools/default-tools.json); the reminder targets human-authored CLI changes. + if strings.HasPrefix(config.headBranch, releasePleaseBranchPrefix) { + writeMinimumVersionWarningLine(stdout, "Skipping CLI minimum version check because this is a release-please release PR.") + return 0 + } + if config.baseRef == "" { writeMinimumVersionWarningLine(stdout, "Skipping CLI minimum version comment because no base ref was provided.") return 0 @@ -127,6 +137,7 @@ func minimumVersionWarningConfigFromEnvironment() (minimumVersionWarningConfig, repository: os.Getenv("GITHUB_REPOSITORY"), baseRef: baseRef, headRef: headRef, + headBranch: os.Getenv("GITHUB_HEAD_REF"), failOnWarning: os.Getenv("CLI_MINIMUM_VERSION_FAIL_ON_WARNING") == "true", }, nil } diff --git a/cli/internal/automation/minimum_version_warning_test.go b/cli/internal/automation/minimum_version_warning_test.go index 72348e9a6d..e0198a637b 100644 --- a/cli/internal/automation/minimum_version_warning_test.go +++ b/cli/internal/automation/minimum_version_warning_test.go @@ -64,6 +64,33 @@ func TestMinimumVersionWarningSkipsMissingBaseRefBeforeRepositoryResolution(t *t } } +// Verifies that release-please release PRs skip the check before any git diff runs. +func TestMinimumVersionWarningSkipsReleasePleaseHeadBranch(t *testing.T) { + t.Setenv("ULOOP_REPOSITORY_ROOT", t.TempDir()) + t.Setenv("PR_NUMBER", "123") + t.Setenv("GITHUB_REPOSITORY", "owner/repository") + t.Setenv("GITHUB_BASE_REF", "v3-beta") + t.Setenv("GITHUB_HEAD_REF", "release-please--branches--v3-beta") + t.Setenv("CLI_MINIMUM_VERSION_BASE_REF", "") + t.Setenv("CLI_MINIMUM_VERSION_HEAD_REF", "") + t.Setenv("CLI_MINIMUM_VERSION_FAIL_ON_WARNING", "true") + t.Setenv("PATH", t.TempDir()) + + stdout := bytes.Buffer{} + stderr := bytes.Buffer{} + exitCode := RunMinimumVersionWarning(context.Background(), &stdout, &stderr) + + if exitCode != 0 { + t.Fatalf("expected release-please head branch to skip with exit code 0, got %d\n%s", exitCode, stderr.String()) + } + if stdout.String() != "Skipping CLI minimum version check because this is a release-please release PR.\n" { + t.Fatalf("expected release-please skip message, got %q", stdout.String()) + } + if stderr.String() != "" { + t.Fatalf("expected no stderr on release-please skip, got %q", stderr.String()) + } +} + // Verifies that Go CLI source changes require a minimum-version warning. func TestMinimumVersionWarningRequiresCommentForGoCliSourceChanges(t *testing.T) { testCases := []struct { From b40b2fb1b4fa7001a2574f782abb00a08aad6c54 Mon Sep 17 00:00:00 2001 From: hatayama Date: Sat, 13 Jun 2026 01:59:10 +0900 Subject: [PATCH 2/2] chore: Force next CLI release version to 3.0.0-beta.31 Since cli-v3.0.0-beta.24, seven PRs each manually bumped cli/contract.json cliVersion (now 3.0.0-beta.31) and MINIMUM_REQUIRED_CLI_VERSION, but release-please still computes the next CLI release as 3.0.0-beta.25 from its manifest. Releasing that would downgrade the embedded cliVersion below the package's minimum requirement and tell every user to update to a CLI version that does not exist. Pin the cli component to release-as 3.0.0-beta.31 so the release matches the already-stamped contract version. This is a one-shot override: remove it right after cli-v3.0.0-beta.31 is published, or the next release would try to reuse the same version. --- release-please-config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/release-please-config.json b/release-please-config.json index 842bb28744..fdb02b5ed7 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -21,6 +21,7 @@ }, "cli": { "component": "cli", + "release-as": "3.0.0-beta.31", "release-type": "go", "versioning": "prerelease", "prerelease": true,