From d6b69cd0e022a748e67fd08f933268b4089431ed Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:07:36 -0700 Subject: [PATCH 01/12] Plan step 1: Add the regression test for the NCode Review cooldown note --- tests/Test-UpdateNotes.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Test-UpdateNotes.ps1 b/tests/Test-UpdateNotes.ps1 index c58b64af..65cd8923 100644 --- a/tests/Test-UpdateNotes.ps1 +++ b/tests/Test-UpdateNotes.ps1 @@ -31,7 +31,8 @@ the badge, and nothing when README.md has it or the answer is unset. code-review Get-CodeReviewNote names a code-review.yml that pins NCodeGroup/code-review before v1.5.0, passes no approve: true or passes it without approver-private-key, and an AGENTS.md Landing section that - doesn't say draft: yes, and says nothing for a current setup or a project without code-review.yml. + doesn't say draft: yes, says when ADR-0009's cooldown lets a project adopt v1.5.0, and says nothing + for a current setup or a project without code-review.yml. immutable Get-ImmutableReleaseNote says to delete or leave out SECURITY.md's "Releases are immutable" paragraph when a workflow runs on a release event or uploads release assets, and nothing otherwise, such as for an upload named only in a comment line. @@ -308,7 +309,7 @@ $codeReviewNote = & { $pin = 'NCodeGroup/code-review@0123456789abcdef0123456789abcdef01234567' $review = { param([string]$Tag, [bool]$Approve) "jobs:`n review:`n steps:`n - uses: $pin # $Tag`n with:`n$(if ($Approve) { " approve: true`n approver-private-key: `${{ secrets.NCODE_REVIEW_APPROVER_PRIVATE_KEY }}`n" })" } $reviewCases = [ordered]@{ - 'old pin, no approve, draft no' = @{ Workflow = (& $review 'v1.3.0' $false); Agents = "# P`n`n## Landing`n`n- draft: no`n"; Want = @('pins NCodeGroup/code-review v1.3.0', 'passes no approve: true', 'says draft: no', 'Set-RepositoryBaseline.ps1 again'); Not = @() } + 'old pin, no approve, draft no' = @{ Workflow = (& $review 'v1.3.0' $false); Agents = "# P`n`n## Landing`n`n- draft: no`n"; Want = @('pins NCodeGroup/code-review v1.3.0', 'passes no approve: true', 'says draft: no', 'Set-RepositoryBaseline.ps1 again', 'adopts it from 2026-11-24', 'commented exception'); Not = @() } 'current' = @{ Workflow = (& $review 'v1.5.0' $true); Agents = "# P`n`n## Landing`n`n- draft: yes`n"; Want = @(); Not = @() } 'newer, two jobs' = @{ Workflow = (& $review 'v1.10.0' $true) + " - uses: $pin # v1.12.1`n"; Agents = "# P`n`n## Landing`n`n- draft: yes`n"; Want = @(); Not = @() } 'no draft line' = @{ Workflow = (& $review 'v1.5.0' $true); Agents = "# P`n`n## Landing`n`n- integrate: pull-request`n"; Want = @('has no draft line'); Not = @('pins', 'passes no approve') } From 6757f1df1c5a3ee32f1542d331e6cc290fd7eac3 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:08:25 -0700 Subject: [PATCH 02/12] Plan step 2: Say when v1.5.0's cooldown ends in the NCode Review note --- README.md | 2 +- template/.template/Update-Project.ps1 | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dbeb1191..62464ed6 100644 --- a/README.md +++ b/README.md @@ -430,7 +430,7 @@ No license: the license answer is blank and the repository has no LICENSE or COP When the `best_practices_project` answer is set and `README.md` doesn't show the project's OpenSSF Best Practices badge, the update says so, also when the project is already up to date, and prints the line to add near the top of `README.md`, which `documentation_achievements` asks for within 48 hours of earning a level: `README.md` is project-owned, so the template never adds it there ([ADR-0025](template/docs/decisions/project-template/0025-every-best-practices-criterion-is-mapped-in-a-template-owned-page.md)). -With NCode Review, when `.github/workflows/code-review.yml` pins `NCodeGroup/code-review` before v1.5.0, passes no `approve: true` or passes it without `approver-private-key`, or `AGENTS.md`'s Landing section doesn't say `draft: yes`, the update says what to change, also when the project is already up to date, to store the approver's key with NCodeGroup/code-review's `tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath`, and to run `tools/Set-RepositoryBaseline.ps1` again, so the default branch requires one approval, of the last push, once NCode Review's approver is set up or a second person has write access, and none with one writer, since GitHub counts no approval from NCode Review ([ADR-0022](template/docs/decisions/project-template/0022-ncode-reviews-approval-gates-the-merge.md.jinja), [ADR-0034](template/docs/decisions/project-template/0034-with-one-writer-the-baseline-requires-no-approval.md)). Both files are the project's, so the update changes neither. +With NCode Review, when `.github/workflows/code-review.yml` pins `NCodeGroup/code-review` before v1.5.0, passes no `approve: true` or passes it without `approver-private-key`, or `AGENTS.md`'s Landing section doesn't say `draft: yes`, the update says what to change, also when the project is already up to date, to store the approver's key with NCodeGroup/code-review's `tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath`, and to run `tools/Set-RepositoryBaseline.ps1` again, so the default branch requires one approval, of the last push, once NCode Review's approver is set up or a second person has write access, and none with one writer, since GitHub counts no approval from NCode Review ([ADR-0022](template/docs/decisions/project-template/0022-ncode-reviews-approval-gates-the-merge.md.jinja), [ADR-0034](template/docs/decisions/project-template/0034-with-one-writer-the-baseline-requires-no-approval.md)). It also says that NCode Review v1.5.0, published on 2026-11-21, waits out the three-day cooldown of [ADR-0009](template/docs/decisions/project-template/0009-new-dependency-versions-wait-a-cooldown.md) until 2026-11-24, or is adopted sooner only by that record's commented exception. Both files are the project's, so the update changes neither. When the project has version tags merged into the current branch that its changelog has no section for, such as releases from before it had a changelog, the update ends with a request to backfill them: diff --git a/template/.template/Update-Project.ps1 b/template/.template/Update-Project.ps1 index e0aeac3d..ff1983b6 100644 --- a/template/.template/Update-Project.ps1 +++ b/template/.template/Update-Project.ps1 @@ -95,7 +95,7 @@ in .github/workflows runs on a release event or uploads release assets, whose releases the template's tools/Set-RepositoryBaseline.ps1 leaves mutable, it says to delete or leave out that paragraph, also when the project is already up to date (the template's ADR-0028). - With NCode Review, when .github/workflows/code-review.yml pins NCodeGroup/code-review before v1.5.0, passes no approve: true or passes approve: true without approver-private-key, or AGENTS.md's Landing section doesn't say draft: yes, it says what to change, to store the approver's key with tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath from NCodeGroup/code-review and to run the template's tools/Set-RepositoryBaseline.ps1 again, also when the project is already up to date (the template's ADR-0022 and ADR-0036). + With NCode Review, when .github/workflows/code-review.yml pins NCodeGroup/code-review before v1.5.0, passes no approve: true or passes approve: true without approver-private-key, or AGENTS.md's Landing section doesn't say draft: yes, it says what to change, to store the approver's key with tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath from NCodeGroup/code-review and to run the template's tools/Set-RepositoryBaseline.ps1 again, also when the project is already up to date (the template's ADR-0022 and ADR-0036). It says that v1.5.0, published on 2026-11-21, waits out the three-day cooldown of the template's ADR-0009 until 2026-11-24, or is adopted sooner only by that record's commented exception. On Windows it stops before it changes anything when the project's template version has a path Git for Windows refuses to check out, such as the uses_node file names of v0.69.0 to v0.75.0, because the update starts with @@ -321,7 +321,8 @@ function Get-CiPermissionNote { # NCode Review approves a clean pull request only with approve: true, and from NCodeGroup/code-review v1.5.0 on submits the # approval as the NCode Review Approver, which meets a required approval, when approver-private-key is passed; code-review.yml -# and AGENTS.md are project-owned, so the update can only say what they still lack (the template's ADR-0022 and ADR-0036). +# and AGENTS.md are project-owned, so the update can only say what they still lack (the template's ADR-0022 and ADR-0036), +# and when ADR-0009's cooldown lets it adopt v1.5.0. function Get-CodeReviewNote { $workflow = '.github/workflows/code-review.yml' if (-not (Test-Path -LiteralPath $workflow -PathType Leaf)) { return } @@ -349,7 +350,7 @@ function Get-CodeReviewNote { } if (-not $findings.Count) { return } '' - "NCode Review approves a clean pull request only with approve: true, and from NCodeGroup/code-review v1.5.0 on, given approver-private-key, submits the approval as the NCode Review Approver, an app that can write, so the approval meets a required approval (the template's ADR-0022, ADR-0034 and ADR-0036, in docs/decisions/project-template/): $($findings -join '; '). Pin v1.5.0 or later and pass approve: true and approver-private-key: `${{ secrets.NCODE_REVIEW_APPROVER_PRIVATE_KEY }} in the review job of .github/workflows/code-review.yml, as the template's code-review.yml does, store the approver's key in the code-review environment with tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath from NCodeGroup/code-review, set - draft: yes in AGENTS.md's Landing section, so a pull request opens as a draft and marking it ready is the maintainer's review, then run the template's tools/Set-RepositoryBaseline.ps1 again, so the default branch dismisses stale approvals and requires one approval, of the last push, where the approver is set up or a second person has write access." + "NCode Review approves a clean pull request only with approve: true, and from NCodeGroup/code-review v1.5.0 on, given approver-private-key, submits the approval as the NCode Review Approver, an app that can write, so the approval meets a required approval (the template's ADR-0022, ADR-0034 and ADR-0036, in docs/decisions/project-template/): $($findings -join '; '). Pin v1.5.0 or later (published on 2026-11-21: the three-day cooldown of the template's ADR-0009 adopts it from 2026-11-24, and sooner only by that record's commented exception) and pass approve: true and approver-private-key: `${{ secrets.NCODE_REVIEW_APPROVER_PRIVATE_KEY }} in the review job of .github/workflows/code-review.yml, as the template's code-review.yml does, store the approver's key in the code-review environment with tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath from NCodeGroup/code-review, set - draft: yes in AGENTS.md's Landing section, so a pull request opens as a draft and marking it ready is the maintainer's review, then run the template's tools/Set-RepositoryBaseline.ps1 again, so the default branch dismisses stale approvals and requires one approval, of the last push, where the approver is set up or a second person has write access." } # Nerdbank.GitVersioning, which version.json turns on (the template's ADR-0138), fails a build on a shallow clone and ignores -p:Version: name each job of the project's own workflows, other than publish.yml, which has its own check, that builds, packs, tests without --no-build or pushes packages with a shallow actions/checkout or a -p:Version argument. From 8333519ec5b9ab31a03e22bb3e8fdd75f0a37370 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:08:54 -0700 Subject: [PATCH 03/12] Plan step 3: Pin NCode Review v1.5.0 by ADR-0009's commented exception --- template/.github/workflows/code-review.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/template/.github/workflows/code-review.yml b/template/.github/workflows/code-review.yml index 908ad5c8..ec80e806 100644 --- a/template/.github/workflows/code-review.yml +++ b/template/.github/workflows/code-review.yml @@ -24,6 +24,9 @@ name: Code review # docs/decisions/project-template/0022-ncode-reviews-approval-gates-the-merge.md, # 0034-with-one-writer-the-baseline-requires-no-approval.md and # 0036-a-required-approval-is-met-by-ncode-reviews-approver-app.md say why. +# v1.5.0 was released on 2026-11-21, under the three days ADR-0009 waits: approver-private-key needs it, so it is +# pinned by that record's commented exception, and this sentence goes once 2026-11-24 has passed +# (NCodeGroup/project-template#464). # # pull_request_target and issue_comment both run this file from the default branch, so a pull request can't change its # own review. The engine fetches its code only to read it: nothing from it is built, run or installed. From 9ab088c8920fe50ac12972eb0b517186a73d6579 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:09:50 -0700 Subject: [PATCH 04/12] Plan step 4: Add regression tests for checkouts no build runs in --- tests/Test-UpdateNotes.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/Test-UpdateNotes.ps1 b/tests/Test-UpdateNotes.ps1 index 65cd8923..4a002684 100644 --- a/tests/Test-UpdateNotes.ps1 +++ b/tests/Test-UpdateNotes.ps1 @@ -17,9 +17,10 @@ tools\adopt\Adoption.psm1's copy prints the same. gitversioning Get-GitVersioningWorkflowNote names each job of a workflow other than publish.yml that builds, packs, tests without --no-build or pushes packages with an actions/checkout step without - fetch-depth: 0 or with a -p:Version argument when version.json exists, and says nothing for full - history, a flow mapping, --no-build, a job that doesn't build, publish.yml or a project without - version.json. + fetch-depth: 0 or with a -p:Version argument when version.json exists, and says nothing for a checkout + whose folder holds no build step's working directory (its working-directory:, or the job's or + workflow's defaults:), for full history, a flow mapping, --no-build, a job that doesn't build, + publish.yml or a project without version.json. tools\adopt\Adoption.psm1's copy prints the same. publisher Get-NuGetPublisherAnswer names the workflows other than publish.yml that run nuget push, joined with ", ", when the library has no publish.yml, and is blank beside a publish.yml, without such a workflow or @@ -186,6 +187,13 @@ $gitVersioningNote = & { 'named step' = @{ Text = $head + " - name: Check out`n uses: actions/checkout@v4`n with:`n persist-credentials: false`n - run: dotnet test`n"; Want = @('job build: actions/checkout without fetch-depth: 0') } 'tests without a build' = @{ Text = $head + " - uses: actions/checkout@v4`n - run: dotnet test --no-build`n"; Want = @() } 'other job' = @{ Text = "on: push`njobs:`n lint:`n runs-on: ubuntu-latest`n steps:`n - uses: actions/checkout@v4`n - run: npm run lint`n pack:`n runs-on: ubuntu-latest`n steps:`n - uses: actions/checkout@v4`n with:`n fetch-depth: 0`n - run: dotnet pack`n"; Want = @() } + 'checkout no build runs in' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n persist-credentials: false`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - name: Rebuild`n working-directory: rebuild`n run: dotnet pack --configuration Release`n - run: ./current/build/Compare-Packages.ps1`n"; Want = @() } + 'build in a nested checkout' = @{ Text = $head + " - uses: actions/checkout@v4`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - working-directory: rebuild`n run: dotnet build`n"; Want = @() } + 'job default working directory' = @{ Text = "on: push`njobs:`n build:`n runs-on: ubuntu-latest`n defaults:`n run:`n working-directory: ./rebuild/`n steps:`n - uses: actions/checkout@v4`n with: { path: current }`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - run: dotnet pack`n"; Want = @() } + 'workflow default working directory' = @{ Text = "on: push`ndefaults:`n run:`n working-directory: rebuild`njobs:`n build:`n runs-on: ubuntu-latest`n steps:`n - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - run: dotnet pack`n"; Want = @() } + 'shallow checkout a build runs in' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n fetch-depth: 0`n - uses: actions/checkout@v4`n with:`n path: rebuild`n - working-directory: rebuild/src`n run: dotnet build`n"; Want = @('.github/workflows/main.yml, job build: actions/checkout (path: rebuild) without fetch-depth: 0'); Not = @('(path: current)') } + 'build outside every checkout' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - run: dotnet build rebuild/x.sln`n"; Want = @('job build: actions/checkout (path: current) without fetch-depth: 0') } + 'working directory from an expression' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - working-directory: `${{ inputs.folder }}`n run: dotnet build`n"; Want = @('job build: actions/checkout (path: current) without fetch-depth: 0') } 'publish.yml' = @{ Text = $shallow; File = 'publish.yml'; Want = @() } 'no version.json' = @{ Text = $shallow; VersionJson = $false; Want = @() } } @@ -201,7 +209,8 @@ $gitVersioningNote = & { finally { Pop-Location } if ($case.Want.Count) { $missing = @($case.Want | Where-Object { -not $note.Contains($_) }) - Check "gitversioning: $name" (-not $missing.Count) "missing [$($missing -join '], [')] in [$note]" + $unwanted = @($case.Not | Where-Object { $_ -and $note.Contains($_) }) + Check "gitversioning: $name" (-not $missing.Count -and -not $unwanted.Count) "missing [$($missing -join '], [')], unwanted [$($unwanted -join '], [')] in [$note]" } else { Check "gitversioning: $name" (-not $note.Trim()) "got [$note]" } Check "gitversioning: ${name}: the adoption prints the same note" ($adoptNote -eq $note) "update [$note], adopt [$adoptNote]" From 8865b756db6606d5ac34ba3c3e024813f21d299e Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:11:19 -0700 Subject: [PATCH 05/12] Plan step 5: Give the shallow-clone check helpers for steps, folders and defaults --- template/.template/Update-Project.ps1 | 37 ++++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/template/.template/Update-Project.ps1 b/template/.template/Update-Project.ps1 index ff1983b6..a97b56df 100644 --- a/template/.template/Update-Project.ps1 +++ b/template/.template/Update-Project.ps1 @@ -358,16 +358,31 @@ function Get-CodeReviewNote { function Get-GitVersioningWorkflowNote { if (-not (Test-Path -LiteralPath version.json) -or -not (Test-Path -LiteralPath .github/workflows -PathType Container)) { return } $findings = [Collections.Generic.List[string]]::new() + # A folder as the workspace-relative path actions/checkout's path: or a working-directory: names it: '' for the workspace, $null for one this check can't place. + $folderOf = { + param([string]$Value) + $v = ($Value -replace '\s+#.*$', '').Trim().Trim('''', '"').Trim() + $v = $v -replace '^\$\{\{\s*github\.workspace\s*\}\}/?', '' -replace '^(?:\./)+', '' -replace '/+$', '' + if ($v -eq '.') { $v = '' } + if ($v -match '\$\{\{|^/|^[A-Za-z]:|(?:^|/)\.\.(?:/|$)') { return $null } + $v + } + # The first capture of Pattern in Lines, or $null when no line matches. + $valueIn = { param([string[]]$Lines, [string]$Pattern) foreach ($l in $Lines) { if ($l -match $Pattern) { return $Matches[1] } } } + $isBuild = { param([string]$Line) $Line -match '(?i)\bdotnet\s+(?:build|pack)\b' -or ($Line -match '(?i)\bdotnet\s+test\b' -and $Line -notmatch '--no-build') -or $Line -match '(?i)\bnuget(?:\.exe)?\s+push\b' } foreach ($file in @(Get-ChildItem -LiteralPath .github/workflows -File | Where-Object { $_.Name -match '\.ya?ml$' -and $_.Name -ne 'publish.yml' } | Sort-Object Name)) { - # The lines of each job under the top-level jobs: key, by job name. + # The lines of each job under the top-level jobs: key, by job name, and the lines of the top-level defaults: key. $jobs = [ordered]@{} + $defaults = [Collections.Generic.List[string]]::new() $inJobs = $false + $inDefaults = $false $jobIndent = -1 $current = $null foreach ($line in Get-Content -LiteralPath $file.FullName) { if ($line -match '^\s*(#.*)?$') { continue } $indent = $line.Length - $line.TrimStart().Length - if ($indent -eq 0) { $inJobs = $line -match '^jobs:\s*(#.*)?$'; $jobIndent = -1; $current = $null; continue } + if ($indent -eq 0) { $inJobs = $line -match '^jobs:\s*(#.*)?$'; $inDefaults = $line -match '^defaults:\s*(#.*)?$'; $jobIndent = -1; $current = $null; continue } + if ($inDefaults) { $defaults.Add($line); continue } if (-not $inJobs) { continue } if ($jobIndent -lt 0) { $jobIndent = $indent } if ($indent -eq $jobIndent -and $line -match '^\s*([\w-]+):') { @@ -377,22 +392,26 @@ function Get-GitVersioningWorkflowNote { } if ($current) { $jobs[$current].Add($line) } } + $workflowDefault = & $valueIn $defaults '^\s*working-directory:\s*(.*)$' foreach ($name in $jobs.Keys) { $lines = @($jobs[$name]) - $builds = @($lines | Where-Object { $_ -match '(?i)\bdotnet\s+(?:build|pack)\b' -or ($_ -match '(?i)\bdotnet\s+test\b' -and $_ -notmatch '--no-build') -or $_ -match '(?i)\bnuget(?:\.exe)?\s+push\b' }) - if (-not $builds.Count) { continue } - for ($i = 0; $i -lt $lines.Count; $i++) { - if ($lines[$i] -notmatch '\buses:\s*[''"]?actions/checkout@') { continue } + if (-not @($lines | Where-Object { & $isBuild $_ }).Count) { continue } + $stepAt = { + param([int]$At) # The step starts at the nearest line at or above that starts a list item, and ends before the next one no deeper. - $start = $i + $start = $At while ($start -ge 0 -and $lines[$start] -notmatch '^\s*-\s') { $start-- } - if ($start -lt 0) { $start = $i } + if ($start -lt 0) { $start = $At } $startIndent = $lines[$start].Length - $lines[$start].TrimStart().Length $end = $lines.Count for ($j = $start + 1; $j -lt $lines.Count; $j++) { if ($lines[$j] -match '^\s*-\s' -and ($lines[$j].Length - $lines[$j].TrimStart().Length) -le $startIndent) { $end = $j; break } } - $step = @($lines[$start..($end - 1)]) + $lines[$start..($end - 1)] + } + for ($i = 0; $i -lt $lines.Count; $i++) { + if ($lines[$i] -notmatch '\buses:\s*[''"]?actions/checkout@') { continue } + $step = @(& $stepAt $i) if (-not @($step | Where-Object { $_ -match '(? Date: Sat, 21 Nov 2026 14:12:47 -0700 Subject: [PATCH 06/12] Plan step 6: Check only the checkouts a build step runs in --- template/.template/Update-Project.ps1 | 34 +++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/template/.template/Update-Project.ps1 b/template/.template/Update-Project.ps1 index a97b56df..7f5c432b 100644 --- a/template/.template/Update-Project.ps1 +++ b/template/.template/Update-Project.ps1 @@ -353,7 +353,7 @@ function Get-CodeReviewNote { "NCode Review approves a clean pull request only with approve: true, and from NCodeGroup/code-review v1.5.0 on, given approver-private-key, submits the approval as the NCode Review Approver, an app that can write, so the approval meets a required approval (the template's ADR-0022, ADR-0034 and ADR-0036, in docs/decisions/project-template/): $($findings -join '; '). Pin v1.5.0 or later (published on 2026-11-21: the three-day cooldown of the template's ADR-0009 adopts it from 2026-11-24, and sooner only by that record's commented exception) and pass approve: true and approver-private-key: `${{ secrets.NCODE_REVIEW_APPROVER_PRIVATE_KEY }} in the review job of .github/workflows/code-review.yml, as the template's code-review.yml does, store the approver's key in the code-review environment with tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath from NCodeGroup/code-review, set - draft: yes in AGENTS.md's Landing section, so a pull request opens as a draft and marking it ready is the maintainer's review, then run the template's tools/Set-RepositoryBaseline.ps1 again, so the default branch dismisses stale approvals and requires one approval, of the last push, where the approver is set up or a second person has write access." } -# Nerdbank.GitVersioning, which version.json turns on (the template's ADR-0138), fails a build on a shallow clone and ignores -p:Version: name each job of the project's own workflows, other than publish.yml, which has its own check, that builds, packs, tests without --no-build or pushes packages with a shallow actions/checkout or a -p:Version argument. +# Nerdbank.GitVersioning, which version.json turns on (the template's ADR-0138), fails a build on a shallow clone and ignores -p:Version: name each job of the project's own workflows, other than publish.yml, which has its own check, that builds, packs, tests without --no-build or pushes packages in a shallow actions/checkout's folder, by the step's working-directory: or the job's or workflow's defaults:, or with a -p:Version argument. # tools/adopt/Adoption.psm1 has a deliberate copy of this function for the template's Adopt-Project.ps1. Change both together; tests/Test-UpdateNotes.ps1 runs both copies through the same cases. function Get-GitVersioningWorkflowNote { if (-not (Test-Path -LiteralPath version.json) -or -not (Test-Path -LiteralPath .github/workflows -PathType Container)) { return } @@ -409,11 +409,37 @@ function Get-GitVersioningWorkflowNote { } $lines[$start..($end - 1)] } - for ($i = 0; $i -lt $lines.Count; $i++) { + # The job's own defaults: working-directory, else the workflow's. + $keyIndent = $lines[0].Length - $lines[0].TrimStart().Length + $jobDefaults = [Collections.Generic.List[string]]::new() + $inJobDefaults = $false + foreach ($l in $lines) { + $lineIndent = $l.Length - $l.TrimStart().Length + if ($lineIndent -le $keyIndent) { $inJobDefaults = $l -match '^\s*defaults:\s*(#.*)?$'; continue } + if ($inJobDefaults) { $jobDefaults.Add($l) } + } + $jobDefault = & $valueIn $jobDefaults '^\s*working-directory:\s*(.*)$' + if ($null -eq $jobDefault) { $jobDefault = $workflowDefault } + $checkouts = @(for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -notmatch '\buses:\s*[''"]?actions/checkout@') { continue } $step = @(& $stepAt $i) - if (-not @($step | Where-Object { $_ -match '(? Date: Sat, 21 Nov 2026 14:14:34 -0700 Subject: [PATCH 07/12] Plan step 7: Copy the check into the adoption module --- tools/adopt/Adoption.psm1 | 69 ++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/tools/adopt/Adoption.psm1 b/tools/adopt/Adoption.psm1 index 32930628..5d66b9ea 100644 --- a/tools/adopt/Adoption.psm1 +++ b/tools/adopt/Adoption.psm1 @@ -840,21 +840,36 @@ function Get-CiPermissionNote { ".github/workflows/ci.yml asks for more than contents: read: $($findings -join '; '). .github/workflows/tag-release.yml runs ci.yml as a reusable workflow before it tags a release and grants it only contents: read, and GitHub fails that run as it starts when a job of ci.yml asks for more, whatever the job's if: says, so no release is tagged or published. Move each such job into a workflow of its own, such as .github/workflows/coverage.yml, and keep ci.yml's top-level permissions at contents: read (the template's ADR-0026, in docs/decisions/project-template/)." } -# Nerdbank.GitVersioning, which version.json turns on (the template's ADR-0138), fails a build on a shallow clone and ignores -p:Version: name each job of the project's own workflows, other than publish.yml, which has its own check, that builds, packs, tests without --no-build or pushes packages with a shallow actions/checkout or a -p:Version argument. +# Nerdbank.GitVersioning, which version.json turns on (the template's ADR-0138), fails a build on a shallow clone and ignores -p:Version: name each job of the project's own workflows, other than publish.yml, which has its own check, that builds, packs, tests without --no-build or pushes packages in a shallow actions/checkout's folder, by the step's working-directory: or the job's or workflow's defaults:, or with a -p:Version argument. # template/.template/Update-Project.ps1 has a deliberate copy of this function, since it runs on its own. Change both together; tests/Test-UpdateNotes.ps1 runs both copies through the same cases. function Get-GitVersioningWorkflowNote { if (-not (Test-Path -LiteralPath version.json) -or -not (Test-Path -LiteralPath .github/workflows -PathType Container)) { return } $findings = [Collections.Generic.List[string]]::new() + # A folder as the workspace-relative path actions/checkout's path: or a working-directory: names it: '' for the workspace, $null for one this check can't place. + $folderOf = { + param([string]$Value) + $v = ($Value -replace '\s+#.*$', '').Trim().Trim('''', '"').Trim() + $v = $v -replace '^\$\{\{\s*github\.workspace\s*\}\}/?', '' -replace '^(?:\./)+', '' -replace '/+$', '' + if ($v -eq '.') { $v = '' } + if ($v -match '\$\{\{|^/|^[A-Za-z]:|(?:^|/)\.\.(?:/|$)') { return $null } + $v + } + # The first capture of Pattern in Lines, or $null when no line matches. + $valueIn = { param([string[]]$Lines, [string]$Pattern) foreach ($l in $Lines) { if ($l -match $Pattern) { return $Matches[1] } } } + $isBuild = { param([string]$Line) $Line -match '(?i)\bdotnet\s+(?:build|pack)\b' -or ($Line -match '(?i)\bdotnet\s+test\b' -and $Line -notmatch '--no-build') -or $Line -match '(?i)\bnuget(?:\.exe)?\s+push\b' } foreach ($file in @(Get-ChildItem -LiteralPath .github/workflows -File | Where-Object { $_.Name -match '\.ya?ml$' -and $_.Name -ne 'publish.yml' } | Sort-Object Name)) { - # The lines of each job under the top-level jobs: key, by job name. + # The lines of each job under the top-level jobs: key, by job name, and the lines of the top-level defaults: key. $jobs = [ordered]@{} + $defaults = [Collections.Generic.List[string]]::new() $inJobs = $false + $inDefaults = $false $jobIndent = -1 $current = $null foreach ($line in Get-Content -LiteralPath $file.FullName) { if ($line -match '^\s*(#.*)?$') { continue } $indent = $line.Length - $line.TrimStart().Length - if ($indent -eq 0) { $inJobs = $line -match '^jobs:\s*(#.*)?$'; $jobIndent = -1; $current = $null; continue } + if ($indent -eq 0) { $inJobs = $line -match '^jobs:\s*(#.*)?$'; $inDefaults = $line -match '^defaults:\s*(#.*)?$'; $jobIndent = -1; $current = $null; continue } + if ($inDefaults) { $defaults.Add($line); continue } if (-not $inJobs) { continue } if ($jobIndent -lt 0) { $jobIndent = $indent } if ($indent -eq $jobIndent -and $line -match '^\s*([\w-]+):') { @@ -864,24 +879,54 @@ function Get-GitVersioningWorkflowNote { } if ($current) { $jobs[$current].Add($line) } } + $workflowDefault = & $valueIn $defaults '^\s*working-directory:\s*(.*)$' foreach ($name in $jobs.Keys) { $lines = @($jobs[$name]) - $builds = @($lines | Where-Object { $_ -match '(?i)\bdotnet\s+(?:build|pack)\b' -or ($_ -match '(?i)\bdotnet\s+test\b' -and $_ -notmatch '--no-build') -or $_ -match '(?i)\bnuget(?:\.exe)?\s+push\b' }) - if (-not $builds.Count) { continue } - for ($i = 0; $i -lt $lines.Count; $i++) { - if ($lines[$i] -notmatch '\buses:\s*[''"]?actions/checkout@') { continue } + if (-not @($lines | Where-Object { & $isBuild $_ }).Count) { continue } + $stepAt = { + param([int]$At) # The step starts at the nearest line at or above that starts a list item, and ends before the next one no deeper. - $start = $i + $start = $At while ($start -ge 0 -and $lines[$start] -notmatch '^\s*-\s') { $start-- } - if ($start -lt 0) { $start = $i } + if ($start -lt 0) { $start = $At } $startIndent = $lines[$start].Length - $lines[$start].TrimStart().Length $end = $lines.Count for ($j = $start + 1; $j -lt $lines.Count; $j++) { if ($lines[$j] -match '^\s*-\s' -and ($lines[$j].Length - $lines[$j].TrimStart().Length) -le $startIndent) { $end = $j; break } } - $step = @($lines[$start..($end - 1)]) - if (-not @($step | Where-Object { $_ -match '(? Date: Sat, 21 Nov 2026 14:15:17 -0700 Subject: [PATCH 08/12] Plan step 8: Describe the narrower shallow-clone check --- Adopt-Project.ps1 | 2 +- README.md | 6 +++--- template/.template/Update-Project.ps1 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Adopt-Project.ps1 b/Adopt-Project.ps1 index 6a57f2cd..a750c016 100644 --- a/Adopt-Project.ps1 +++ b/Adopt-Project.ps1 @@ -29,7 +29,7 @@ When tag-release.yml calls a ci.yml the repository kept, it prints the notes .\.template\Update-Project.ps1 prints when that ci.yml has no workflow_call trigger, or when its top-level permissions or a job's ask for more than contents: read, which tag-release.yml grants it: until then, no release is tagged (ADR-0026). - When the repository has version.json, it prints the note .\.template\Update-Project.ps1 prints for each job of the repository's own workflows, other than publish.yml, that builds with an actions/checkout step without fetch-depth: 0 or a -p:Version argument, which Nerdbank.GitVersioning fails on or ignores (ADR-0138). + When the repository has version.json, it prints the note .\.template\Update-Project.ps1 prints for each job of the repository's own workflows, other than publish.yml, that builds in the folder of an actions/checkout step without fetch-depth: 0, or with a -p:Version argument, which Nerdbank.GitVersioning fails on or ignores (ADR-0138). When the SECURITY.md the adoption leaves says releases are immutable and a workflow in .github/workflows runs on a release event or uploads release assets, it prints the note .\.template\Update-Project.ps1 prints: delete that diff --git a/README.md b/README.md index 62464ed6..6f90e769 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,7 @@ Some judgment is left to you. The script prints it as a ready request: folding ` When the repository has version tags merged into the current branch that its changelog has no section for, the request also says to backfill them, such as `backfill CHANGELOG.md from the releases v0.1.0..v0.3.0`. The changelog is the file the `changelog` key of `AGENTS.md`'s Landing section names, `CHANGELOG.md` by default, and only tags shaped like `v1.2.3` or `1.2.3` count. With `pre-release: untracked` in that Landing section, the tags below 1.0.0 don't count. -For a .NET library, adoption sets the `version.json` it adds to the patch after the newest release tag, with the `assemblyVersion` a release of its current major shipped when it was built with a higher one than the template pins, such as `{ "version": "5.3", "precision": "minor" }`, and the request asks to add `-p:PublicRelease=true` to a `publish.yml` the repository keeps without it. A library whose own workflow already runs `nuget push` keeps it alone, without the template's `publish.yml`, `release-provenance.yml` or `raise-baseline.yml`, records it in the `nuget_publisher` answer, and the report says so. Adoption drops the repository's own Nerdbank.GitVersioning reference, which `build/ProjectTemplate.props` makes a second one once `version.json` exists, and reports it; the update warns about a `.gitlab-ci.yml` that packs without `PublicRelease=true` or `GIT_DEPTH: "0"`, as it does for a `publish.yml`, and both name each job of the repository's own workflows that checks out without `fetch-depth: 0` or passes `-p:Version`. Adoption and the update both name the stale NuGet logistics of an older library (an unimported `.props` file, `GeneratePackageOnBuild`, settings the template already makes, a `.sln`, a UTF-8 BOM, projects at the root) and fix none (ADR-0149). They also compare each packable project's Description and PackageTags with the newest published package and name any that differ. A repository that keeps its own `.github/workflows/publish.yml` without a `workflow_dispatch` trigger gets the warning `Update-Project.ps1` prints for it: the Release workflow, `tag-release.yml`, starts `publish.yml` through that trigger, so until it has one, a release ships no packages. +For a .NET library, adoption sets the `version.json` it adds to the patch after the newest release tag, with the `assemblyVersion` a release of its current major shipped when it was built with a higher one than the template pins, such as `{ "version": "5.3", "precision": "minor" }`, and the request asks to add `-p:PublicRelease=true` to a `publish.yml` the repository keeps without it. A library whose own workflow already runs `nuget push` keeps it alone, without the template's `publish.yml`, `release-provenance.yml` or `raise-baseline.yml`, records it in the `nuget_publisher` answer, and the report says so. Adoption drops the repository's own Nerdbank.GitVersioning reference, which `build/ProjectTemplate.props` makes a second one once `version.json` exists, and reports it; the update warns about a `.gitlab-ci.yml` that packs without `PublicRelease=true` or `GIT_DEPTH: "0"`, as it does for a `publish.yml`, and both name each job of the repository's own workflows that builds in a checkout without `fetch-depth: 0` or passes `-p:Version`, leaving out a checkout no build step's working directory lies in. Adoption and the update both name the stale NuGet logistics of an older library (an unimported `.props` file, `GeneratePackageOnBuild`, settings the template already makes, a `.sln`, a UTF-8 BOM, projects at the root) and fix none (ADR-0149). They also compare each packable project's Description and PackageTags with the newest published package and name any that differ. A repository that keeps its own `.github/workflows/publish.yml` without a `workflow_dispatch` trigger gets the warning `Update-Project.ps1` prints for it: the Release workflow, `tag-release.yml`, starts `publish.yml` through that trigger, so until it has one, a release ships no packages. ```text Still to do — in the repository, run: @@ -439,7 +439,7 @@ Version tags without a section in CHANGELOG.md: v0.1.0..v0.3.0. To give the chan /plan-migration Backfill CHANGELOG.md from the releases v0.1.0..v0.3.0 ``` -For a .NET library whose current major has a release built with a higher assembly version than `build/ProjectTemplate.props` pins, such as `5.3.0` built as `5.3.0.0` by a build that doesn't pin it, the update writes it into the `version.json` it adds, as the template's ADR-0136 and ADR-0138 say, or, for a library without `version.json`, names the `AssemblyVersion` to set in `Directory.Build.props` until the next major. It leaves `.github/workflows/publish.yml` out of a library whose own workflow already runs `nuget push`, so a published release runs one publisher, and warns when both exist; the `nuget_publisher` answer then names that workflow, so the update also leaves out `release-provenance.yml` and `raise-baseline.yml`, deleting them where an earlier update added them, and renders the documents it adds, and the template changes it shows, with that workflow in place of `publish.yml`. A `version.json` the update adds starts at the patch after the newest release tag, and while the library has one, the update warns about a `publish.yml` that packs without `-p:PublicRelease=true` and names the files that reference Nerdbank.GitVersioning themselves, and each job of the project's own workflows, other than `publish.yml`, that builds, packs, tests or pushes packages with an `actions/checkout` step without `fetch-depth: 0`, on which Nerdbank.GitVersioning fails the build, or with a `-p:Version` argument, which it ignores. A NuGet package needs a license: when a library's answers and `-Data` give none, the update stops before it changes anything and prints the `-Data @{ license = '' }` to run it with. +For a .NET library whose current major has a release built with a higher assembly version than `build/ProjectTemplate.props` pins, such as `5.3.0` built as `5.3.0.0` by a build that doesn't pin it, the update writes it into the `version.json` it adds, as the template's ADR-0136 and ADR-0138 say, or, for a library without `version.json`, names the `AssemblyVersion` to set in `Directory.Build.props` until the next major. It leaves `.github/workflows/publish.yml` out of a library whose own workflow already runs `nuget push`, so a published release runs one publisher, and warns when both exist; the `nuget_publisher` answer then names that workflow, so the update also leaves out `release-provenance.yml` and `raise-baseline.yml`, deleting them where an earlier update added them, and renders the documents it adds, and the template changes it shows, with that workflow in place of `publish.yml`. A `version.json` the update adds starts at the patch after the newest release tag, and while the library has one, the update warns about a `publish.yml` that packs without `-p:PublicRelease=true` and names the files that reference Nerdbank.GitVersioning themselves, and each job of the project's own workflows, other than `publish.yml`, that builds, packs, tests or pushes packages with an `actions/checkout` step without `fetch-depth: 0` whose folder holds such a step's working directory (its `working-directory:`, or the job's or workflow's `defaults:`), on which Nerdbank.GitVersioning fails the build, or with a `-p:Version` argument, which it ignores. A NuGet package needs a license: when a library's answers and `-Data` give none, the update stops before it changes anything and prints the `-Data @{ license = '' }` to run it with. To plan an update instead of running it, run `/plan-template-update` in the project, or name a version: `/plan-template-update v0.14.0`. It reads `.copier-answers.yml` and the release notes since the project's version, runs `Update-Project.ps1 -NoCommit` on a clone of the project in a temporary folder, and plans from what that trial changed. The plan's first step runs the update with `-Ref` pinned to the target and `-NoCommit`, so it is committed as a plan step, and a result that differs from the trial escalates. The next steps run the project's checks and fix the project's own files that still describe the old template, and the last runs the project's tests. Every check is judged by its exit code. The planning session files an issue here for each gap in the template that the trial shows. In Claude Code the plan gets its own worktree, unless the project's `plan-executor` subagent predates v0.11.0 and can't run PowerShell there; then it runs on a `build/project-template-` branch in the current checkout. A project on v0.13.0 or earlier doesn't have the command yet: compose it from this repository's clone with `.\workflow\New-PlanPrompt.ps1 plan-template-update`, or install the commands for your user with `.\workflow\Install-HybridWorkflow.ps1 -User`. @@ -603,7 +603,7 @@ A Dependabot pull request that only moves the NCode Review pin in `.github/workf | `tests/Test-InvokeAllTests.ps1`: `tests/Invoke-AllTests.ps1` runs only the `Test-*.ps1` scripts in a folder and then each `-SetupOnly` line of the `.github/workflows/test-template.yml` in its parent folder, in the workflow's order, each with a `-Work` folder of its own and a log, skipping a line without `-SetupOnly` and counting a failed setup as failed, prints `PASS` or `FAIL` per suite with a failed suite's `FAIL` lines, logs each suite's output, counts a suite that throws as failed, passes `-SkipDotnetBuild` only to suites that take it, points the suites' Copier cache at the run's own folder, exits 1 when a suite fails or none is found, prints the run's wall-clock time as `Time: ` and ends with `All tests: PASSED` or `All tests: FAILED ()`; runs two suites at once and prints their results in name order, not the order they finish, and one at a time with `-Serial` or `-ThrottleLimit 1`; two runs at once without `-Work` log to folders of their own, deleted when the run passes or finds no suites and kept when one fails; `tests/Remove-TestWork.ps1` deletes a folder or says it couldn't; and every suite with `-Work` keeps a folder of its own on a failure, or on an error, when it prints its path, and deletes it on a pass; every suite that builds a template snapshot keeps Copier's mirrors in its work folder, not the user's cache; `tests/Measure-Suites.ps1` prints a suite's median time over `-Repeat` runs and fails the run for a suite that fails, is missing or is slower than `-MaxSeconds`, passing `-SkipDotnetBuild` to a suite that takes it | Always | | `tests/Test-AgentRunner.ps1`: `tests/e2e/Agent.ps1`, against stand-ins for `claude` and `copilot`, runs a prompt and resumes its session with each tool's flags, Claude Code's `--permission-mode bypassPermissions` and `--strict-mcp-config`, Copilot's `--allow-all`, `--no-ask-user`, `--disable-builtin-mcps` and `--secret-env-vars=COPILOT_GITHUB_TOKEN` in a `COPILOT_HOME` of its own with `COPILOT_ALLOW_ALL=true` and the token it read before the run, and puts the environment back; reads the session, adds up the cost, a Copilot session's from its AI credits, prints the command that continues the session, fails a run that returns no session, and a Copilot run that ran no skill for its slash command or loaded an MCP server; takes `GH_TOKEN` when `COPILOT_GITHUB_TOKEN` is unset, with a warning that a general token is in use; caps a Copilot session at 30 AI credits at least and passes no cap for a budget of 0; warns with the path of a usage file it can't read and prints the cost as unknown or as at least what it read; stops a run past `-TimeoutMinutes` with its child processes and fails its session check; and names each tool's run checkout and installed command | Always | | `tests/Test-BrandKit.ps1`: `node brand/build.mjs --check` passes on the committed logo kit, a build into an empty folder writes every file the kit has and passes its own check, and the check fails, naming the file, once one is removed or holds something else | Always | -| `tests/Test-UpdateNotes.ps1`: `.template/Update-Project.ps1` passes `=false` for each opt-in answer the answers file lacks and `-Data` doesn't set; adoption answers `node_lint`, `coverage_gate` and `file_headers` off; the update says to add `workflow_call` to `ci.yml` when `tag-release.yml` calls it without one, and names each job of `ci.yml`, or its top-level `permissions:`, that asks for more than the `contents: read` `tag-release.yml` grants, in a block or a flow mapping, and nothing for `contents: read`, a `none` scope or a step's `with:` input; `tools/adopt/Adoption.psm1`'s copies print the same notes; and it prints the badge line to add when `best_practices_project` is set and `README.md` lacks the badge; and it says to delete or leave out `SECURITY.md`'s "Releases are immutable" paragraph when a workflow runs on a `release` event or uploads release assets, with copies of `Get-WorkflowEvents` and `Test-ReleaseAssetWorkflow` that match the baseline script's, and copies of those and `Get-ImmutableReleaseNote` in `Adopt-Project.ps1` that match the update's; the update names each job of a workflow other than `publish.yml` that builds without `fetch-depth: 0` or passes `-p:Version` once `version.json` exists, says what `code-review.yml` and `AGENTS.md` lack for NCode Review's approval, and works out the `nuget_publisher` and `release_policy` answers, and `tools/adopt/Adoption.psm1`'s copies print and answer the same | Always | +| `tests/Test-UpdateNotes.ps1`: `.template/Update-Project.ps1` passes `=false` for each opt-in answer the answers file lacks and `-Data` doesn't set; adoption answers `node_lint`, `coverage_gate` and `file_headers` off; the update says to add `workflow_call` to `ci.yml` when `tag-release.yml` calls it without one, and names each job of `ci.yml`, or its top-level `permissions:`, that asks for more than the `contents: read` `tag-release.yml` grants, in a block or a flow mapping, and nothing for `contents: read`, a `none` scope or a step's `with:` input; `tools/adopt/Adoption.psm1`'s copies print the same notes; and it prints the badge line to add when `best_practices_project` is set and `README.md` lacks the badge; and it says to delete or leave out `SECURITY.md`'s "Releases are immutable" paragraph when a workflow runs on a `release` event or uploads release assets, with copies of `Get-WorkflowEvents` and `Test-ReleaseAssetWorkflow` that match the baseline script's, and copies of those and `Get-ImmutableReleaseNote` in `Adopt-Project.ps1` that match the update's; the update names each job of a workflow other than `publish.yml` that builds in a checkout without `fetch-depth: 0`, by a step's own or default working directory, or passes `-p:Version` once `version.json` exists, says what `code-review.yml` and `AGENTS.md` lack for NCode Review's approval, and works out the `nuget_publisher` and `release_policy` answers, and `tools/adopt/Adoption.psm1`'s copies print and answer the same | Always | | `tests/Test-Coverage.ps1`: `.template/Test-Coverage.ps1` reads and merges Cobertura and LCOV reports, leaves out test code and the template's files, fails below 90% of the statements or 80% of the branches and names the least covered files, fails without a report, and passes a report that measures no code or no branches | Always | | `tests/Test-FileHeaders.ps1`: `.template/Test-FileHeaders.ps1` fails and names the source files without the copyright or the SPDX line, skips `.template/`, the five template-owned `build/` scripts, `vendor/`, git-ignored files and other kinds of files, checks a tracked `.d.ts` file, checks Astro components inside their frontmatter and stylesheets with `/* */` comments, `-Fix` adds the header at the top, after a `#!` line or inside an Astro frontmatter, a block of its own when there is none, and keeps CRLF and a byte order mark, and a blank license or no author narrows or skips the check | Always | | `tests/e2e/Test-RunIssues.ps1 -SetupOnly`: the fixture project, its local GitHub-shaped `origin` and the `gh` stand-in, where the state script sees `host: github` and `protected: hook`, `origin` has NCode Review's `code-review.yml`, and the stand-in gives a new pull request its seeded review threads and records thread replies; the stand-in gives NCode Review's review of a push on the first read after a `/review` comment that follows the push, footer or not, and with `-Scenario max-rounds` the Landing section has `max-review-rounds: 1`; with `-Scenario review-with-footer` the host folder has `footer.txt` and `footer-pr-only.txt`, which keeps the footer off issue comments, and NCode Review's review of the first push carries a request of the owner's; with `-Scenario push-branch` the Landing section has `max-review-rounds: 1`, `origin`'s `claude/fixture-push-a1b2` holds the head of a pull request #2 that `main` has as a squash commit, and the state script reads that push branch as `landed` from a plan's worktree; and the stand-in's `gh pr view ` picks a branch's open pull request over a merged one, and `gh pr list` without `--state` lists only open ones, as `gh` does | Always | diff --git a/template/.template/Update-Project.ps1 b/template/.template/Update-Project.ps1 index 7f5c432b..ab0e95bd 100644 --- a/template/.template/Update-Project.ps1 +++ b/template/.template/Update-Project.ps1 @@ -79,7 +79,7 @@ ADR-0151). When the project has version.json, it also warns about a publish.yml or a .gitlab-ci.yml that packs without -p:PublicRelease=true and names the files that reference Nerdbank.GitVersioning themselves (the template's ADR-0138). - It also names each job of the project's own workflows, other than publish.yml, that builds, packs, tests without --no-build or pushes packages with an actions/checkout step without fetch-depth: 0, on which Nerdbank.GitVersioning fails the build, or with a -p:Version argument, which it ignores. + It also names each job of the project's own workflows, other than publish.yml, that builds, packs, tests without --no-build or pushes packages with an actions/checkout step without fetch-depth: 0 whose folder holds such a step's working directory (its working-directory:, or the job's or the workflow's defaults:), on which Nerdbank.GitVersioning fails the build, or with a -p:Version argument, which it ignores; when it can't tell which checkout a step runs in, it names each shallow checkout of the job. Such a library's nuget_publisher answer names its own publishing workflows, so the update also leaves out or deletes release-provenance.yml and raise-baseline.yml, and its documents name those workflows instead of publish.yml. When -Data turns csharp_format on, it counts the C# files that don't start with the header .editorconfig sets and names the first five, because IDE0073 then fails the build for each (the template's ADR-0148); it rewrites none. An existing project keeps off the checks a new one starts with until -Data turns them on: csharp_format, node_lint, coverage_gate and file_headers are false when its answers lack them. From ee27fdf59e9258e868b4a0fc4f9a90c3472960dc Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:15:56 -0700 Subject: [PATCH 09/12] Plan step 9: Write the v0.111.2 changelog section --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf86e5b8..5a1b2a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +## [0.111.2] - 2026-11-21 + ### Added - `docs/adopt.md`, a runbook that takes a maintainer from nothing to a fully adopted repository, new or existing, on GitHub or GitLab: the organization's one-time setup, protecting the default branch and tags, releases, a .NET library's nuget.org publishing, NCode Review, the other one-time settings and staying current, each step saying who does it, where, how to check it and what usually goes wrong, and a checklist that audits an adopted repository; the README's table of contents links it ([#468](https://github.com/NCodeGroup/project-template/issues/468)). +### Fixed + +- The template's `code-review.yml` pins NCode Review v1.5.0, released on 2026-11-21, by ADR-0009's commented exception until its three-day cooldown ends on 2026-11-24, and the NCode Review note `.template/Update-Project.ps1` prints says a project adopts v1.5.0 from that day, or sooner only by such an exception ([#464](https://github.com/NCodeGroup/project-template/issues/464), [ADR-0009](template/docs/decisions/project-template/0009-new-dependency-versions-wait-a-cooldown.md)). +- `.template/Update-Project.ps1` and `Adopt-Project.ps1` name a shallow `actions/checkout` of a job that builds with Nerdbank.GitVersioning only when a build step runs in its folder, by the step's `working-directory:` or the job's or workflow's `defaults:`, and give a named checkout's `path:`, so a checkout such as `path: current` beside a build with `working-directory: rebuild` is no longer flagged ([#465](https://github.com/NCodeGroup/project-template/issues/465), [ADR-0138](template/docs/decisions/project-template/0138-package-versions-come-from-version-json-through-nerdbank-gitversioning.md)). + ## [0.111.1] - 2026-11-21 ### Fixed @@ -1809,7 +1816,8 @@ To run the v0.9.0 logic on the first update instead, run the wrapper from a clon - The .NET layer: `build/ProjectTemplate.props` (latest C#, nullable reference types, implicit usings, warnings as errors, `ContinuousIntegrationBuild` when `CI=true`, author metadata), central package management in `Directory.Packages.props`, the SDK in `global.json`, and C# conventions for Copilot and Claude Code. - CI on GitHub or GitLab that runs the build and test commands, with GitHub Actions pinned to commit SHAs, and on GitHub, Dependabot for the CI actions and, by stack, packages and the .NET SDK. -[unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.111.1...HEAD +[unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.111.2...HEAD +[0.111.2]: https://github.com/NCodeGroup/project-template/compare/v0.111.1...v0.111.2 [0.111.1]: https://github.com/NCodeGroup/project-template/compare/v0.111.0...v0.111.1 [0.111.0]: https://github.com/NCodeGroup/project-template/compare/v0.110.0...v0.111.0 [0.110.0]: https://github.com/NCodeGroup/project-template/compare/v0.109.0...v0.110.0 From f578b5e79e79b875115d477c5772933784e76c75 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:36:11 -0700 Subject: [PATCH 10/12] Re-plan step 10: Renumber the release to v0.111.3 From 8b7ac9c3adebba6fb5ae2952d2cb2af20016e567 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:44:30 -0700 Subject: [PATCH 11/12] Plan step 1: Cite the removal follow-up in the cooldown comment --- template/.github/workflows/code-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/.github/workflows/code-review.yml b/template/.github/workflows/code-review.yml index ec80e806..58f0e95f 100644 --- a/template/.github/workflows/code-review.yml +++ b/template/.github/workflows/code-review.yml @@ -26,7 +26,7 @@ name: Code review # 0036-a-required-approval-is-met-by-ncode-reviews-approver-app.md say why. # v1.5.0 was released on 2026-11-21, under the three days ADR-0009 waits: approver-private-key needs it, so it is # pinned by that record's commented exception, and this sentence goes once 2026-11-24 has passed -# (NCodeGroup/project-template#464). +# (NCodeGroup/project-template#475). # # pull_request_target and issue_comment both run this file from the default branch, so a pull request can't change its # own review. The engine fetches its code only to read it: nothing from it is built, run or installed. From e1e21b807ee458a34ea580a240e5239cc48dc6c2 Mon Sep 17 00:00:00 2001 From: Marcin Polewski Date: Sat, 21 Nov 2026 14:45:15 -0700 Subject: [PATCH 12/12] Plan step 2: Pin working-directory precedence and path normalization in the gitversioning tests --- tests/Test-UpdateNotes.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Test-UpdateNotes.ps1 b/tests/Test-UpdateNotes.ps1 index 4a002684..6d85f71e 100644 --- a/tests/Test-UpdateNotes.ps1 +++ b/tests/Test-UpdateNotes.ps1 @@ -18,8 +18,9 @@ gitversioning Get-GitVersioningWorkflowNote names each job of a workflow other than publish.yml that builds, packs, tests without --no-build or pushes packages with an actions/checkout step without fetch-depth: 0 or with a -p:Version argument when version.json exists, and says nothing for a checkout - whose folder holds no build step's working directory (its working-directory:, or the job's or - workflow's defaults:), for full history, a flow mapping, --no-build, a job that doesn't build, + whose folder holds no build step's working directory (its working-directory:, else the job's + defaults:, else the workflow's; a path: or working-directory: may be quoted or start with ./ or + ${{ github.workspace }}/), for full history, a flow mapping, --no-build, a job that doesn't build, publish.yml or a project without version.json. tools\adopt\Adoption.psm1's copy prints the same. publisher Get-NuGetPublisherAnswer names the workflows other than publish.yml that run nuget push, joined with @@ -194,6 +195,10 @@ $gitVersioningNote = & { 'shallow checkout a build runs in' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n fetch-depth: 0`n - uses: actions/checkout@v4`n with:`n path: rebuild`n - working-directory: rebuild/src`n run: dotnet build`n"; Want = @('.github/workflows/main.yml, job build: actions/checkout (path: rebuild) without fetch-depth: 0'); Not = @('(path: current)') } 'build outside every checkout' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - run: dotnet build rebuild/x.sln`n"; Want = @('job build: actions/checkout (path: current) without fetch-depth: 0') } 'working directory from an expression' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n fetch-depth: 0`n - working-directory: `${{ inputs.folder }}`n run: dotnet build`n"; Want = @('job build: actions/checkout (path: current) without fetch-depth: 0') } + 'job default over workflow default' = @{ Text = "on: push`ndefaults:`n run:`n working-directory: current`njobs:`n build:`n runs-on: ubuntu-latest`n defaults:`n run:`n working-directory: rebuild`n steps:`n - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n - run: dotnet pack`n"; Want = @('.github/workflows/main.yml, job build: actions/checkout (path: rebuild) without fetch-depth: 0'); Not = @('(path: current)') } + 'step directory over job default' = @{ Text = "on: push`njobs:`n build:`n runs-on: ubuntu-latest`n defaults:`n run:`n working-directory: current`n steps:`n - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: rebuild`n - working-directory: rebuild`n run: dotnet build`n"; Want = @('.github/workflows/main.yml, job build: actions/checkout (path: rebuild) without fetch-depth: 0'); Not = @('(path: current)') } + 'quoted ./ checkout path' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: './rebuild/'`n - working-directory: rebuild`n run: dotnet build`n"; Want = @('.github/workflows/main.yml, job build: actions/checkout (path: rebuild) without fetch-depth: 0'); Not = @('(path: current)') } + 'directory under github.workspace' = @{ Text = $head + " - uses: actions/checkout@v4`n with:`n path: current`n - uses: actions/checkout@v4`n with:`n path: `"rebuild`"`n - working-directory: '`${{ github.workspace }}/rebuild/src'`n run: dotnet build`n"; Want = @('.github/workflows/main.yml, job build: actions/checkout (path: rebuild) without fetch-depth: 0'); Not = @('(path: current)') } 'publish.yml' = @{ Text = $shallow; File = 'publish.yml'; Want = @() } 'no version.json' = @{ Text = $shallow; VersionJson = $false; Want = @() } }