From 602f35d9501ad74e3508f78fda9fc786d8a42b61 Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Fri, 29 May 2026 18:59:04 +1200 Subject: [PATCH] ci: extend PR-validation triggers to release/v* branches (#291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Branch protection on `release/v11` (applied in #270) requires the `ubuntu-latest` status check, but `.github/workflows/ubuntu-latest.yml` and `.github/workflows/ubuntu-latest-docs.yml` only fired on PRs targeting `main`. Net effect: PRs against `release/v11` had no CI and got BLOCKED by branch protection waiting for a check that never reported — a chicken-and-egg that surfaced when #290 (the NB.GV publicReleaseRefSpec tweak) couldn't merge. Changes: - Both workflows now list `main` AND `release/v*` under `pull_request.branches:`. - `build/Build.cs` gains a `ReleaseBranchPattern = "release/v*"` constant alongside `MainBranch`. - `build/Build.CI.GitHubActions.cs` extends `OnPullRequestBranches` on the ubuntu-latest `[GitHubActions]` attribute to include both branches, so next time the auto-generator runs it produces the same YAML. Out of scope: `windows-latest` and `macos-latest` stay `OnPushBranches` only (post-merge / release validation). They run after merge regardless of base branch via the push trigger. After this lands on main, the same workflow files need to be brought across to `release/v11` (separate PR — same chicken-and-egg until release/v11 also has the updated workflows; will be admin-bypass-merged once). Refs milestone #13. Unblocks #290. Co-authored-by: Claude Opus 4.7 (1M context) --- .github/workflows/ubuntu-latest-docs.yml | 1 + .github/workflows/ubuntu-latest.yml | 1 + build/Build.CI.GitHubActions.cs | 4 +++- build/Build.cs | 7 +++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-latest-docs.yml b/.github/workflows/ubuntu-latest-docs.yml index d1c06f746..1d69dd5bf 100644 --- a/.github/workflows/ubuntu-latest-docs.yml +++ b/.github/workflows/ubuntu-latest-docs.yml @@ -21,6 +21,7 @@ on: pull_request: branches: - main + - 'release/v*' paths: - 'docs/**' - '.assets/**' diff --git a/.github/workflows/ubuntu-latest.yml b/.github/workflows/ubuntu-latest.yml index 73c0e46c4..ab40a8071 100644 --- a/.github/workflows/ubuntu-latest.yml +++ b/.github/workflows/ubuntu-latest.yml @@ -20,6 +20,7 @@ on: pull_request: branches: - main + - 'release/v*' paths-ignore: - 'docs/**' - '.assets/**' diff --git a/build/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index 6c9c0ce79..ddb849f52 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -32,7 +32,9 @@ FetchDepth = 0, Submodules = GitHubActionsSubmodules.Recursive, CheckoutRef = "${{ github.head_ref }}", - OnPullRequestBranches = new[] { MainBranch }, + // Trigger for PRs targeting main OR any release/vN branch — both are + // long-lived and protected; both require the ubuntu-latest status check. + OnPullRequestBranches = new[] { MainBranch, ReleaseBranchPattern }, OnPullRequestExcludePaths = new[] { "docs/**", ".assets/**", "**/*.md" }, InvokedTargets = new[] { nameof(ITest.Test), nameof(IPack.Pack) }, PublishArtifacts = false)] diff --git a/build/Build.cs b/build/Build.cs index 35b724935..3a6ed903d 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -46,6 +46,13 @@ partial class Build const string MainBranch = "main"; + // Glob matching the long-lived release-branch family (release/v11, release/v12, ...). + // Used by Build.CI.GitHubActions to extend PR-validation workflows to cover PRs + // targeting any release branch — branch protection on release/vN requires the + // ubuntu-latest status check, which only fires if the workflow's branches: list + // matches the PR's base ref. See milestone #13. + const string ReleaseBranchPattern = "release/v*"; + // Trunk-based versioning. Nerdbank.GitVersioning computes the canonical version // (major.minor from version.json + git-height as patch). ThisAssembly is generated by // NB.GV at compile time; AssemblyInformationalVersion looks like "10.3.5+abc1234" so we