Skip to content

Write API reference docs to the nearest .github, not the repo root#64

Merged
xavierjohn merged 4 commits into
mainfrom
fix/api-reference-nearest-github
Jul 6, 2026
Merged

Write API reference docs to the nearest .github, not the repo root#64
xavierjohn merged 4 commits into
mainfrom
fix/api-reference-nearest-github

Conversation

@xavierjohn

Copy link
Copy Markdown
Owner

Issue

The packed Trellis.ApiReference.targets copies the shipped API-reference markdown to <gitRoot>/.github on build. In a repository whose subfolders are themselves projects - each with its own .github - building a subproject dumps the docs at the OUTER repo root instead of the subproject's own .github.

Fix

Walk up from the project directory and copy to the nearest existing .github, bounded so the search never crosses above the .git repository root (it cannot escape into an unrelated parent). If no .github exists between the project and the repo root, fall back to creating .github/ at the repo root - the previous behavior for a normal single-repo consumer. The TrellisApiReferenceRoot override is unchanged.

Validation

This targets file is identical to the one shipped by the Trellis framework packages; the same change was validated there end-to-end through a packed consumer on a local feed plus an MSBuild harness (nearest-.github selected; root-only unchanged; no-.github falls back to root; a .github above the repo root is not selected; override honored).

The packed Trellis.ApiReference.targets copied the API-reference markdown
to <gitRoot>/.github on build. In a repository whose subfolders are
themselves projects (each with its own .github), building a subproject
dumped the docs at the outer repo root instead of the subproject's own
.github.

Walk up from the project directory and copy to the NEAREST existing
.github, bounded so the search never crosses above the .git repository
root (so it cannot escape into an unrelated parent). If no .github exists
between the project and the repo root, fall back to creating .github at
the repo root - the previous behavior for a normal single-repo consumer.
The TrellisApiReferenceRoot override is unchanged.
@xavierjohn xavierjohn requested a review from Copilot July 6, 2026 01:20
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results

102 tests  ±0   102 ✅ ±0   14s ⏱️ -1s
  3 suites ±0     0 💤 ±0 
  3 files   ±0     0 ❌ ±0 

Results for commit c496ad8. ± Comparison against base commit f5f30ba.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the packed MSBuild targets (Trellis.ApiReference.targets) so API reference markdown is copied to the nearest existing .github/ directory above the project (but not above the .git repo root), instead of always targeting the outer repository root .github/. This helps multi-project repositories where subfolders are independent projects with their own .github/.

Changes:

  • Adjust destination selection logic to prefer the nearest existing .github/ directory when syncing API reference docs.
  • Bound the upward search so it won’t select a .github/ above the nearest .git repository root.
  • Preserve the TrellisApiReferenceRoot override behavior while updating how the final output directory is derived.

Comment thread build/Trellis.ApiReference.targets Outdated
Comment on lines +112 to +123
<!-- Nearest existing .github at or below the repo root (first match wins). -->
<_TrellisNearestGitHub Condition="'$(_NoGitLt0)' == 'true' AND Exists('$(_Tp0GitHub)')">$(_Tp0GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt1)' == 'true' AND Exists('$(_Tp1GitHub)')">$(_Tp1GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt2)' == 'true' AND Exists('$(_Tp2GitHub)')">$(_Tp2GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt3)' == 'true' AND Exists('$(_Tp3GitHub)')">$(_Tp3GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt4)' == 'true' AND Exists('$(_Tp4GitHub)')">$(_Tp4GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt5)' == 'true' AND Exists('$(_Tp5GitHub)')">$(_Tp5GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt6)' == 'true' AND Exists('$(_Tp6GitHub)')">$(_Tp6GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt7)' == 'true' AND Exists('$(_Tp7GitHub)')">$(_Tp7GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt8)' == 'true' AND Exists('$(_Tp8GitHub)')">$(_Tp8GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt9)' == 'true' AND Exists('$(_Tp9GitHub)')">$(_Tp9GitHub)</_TrellisNearestGitHub>
<_TrellisNearestGitHub Condition="'$(_TrellisNearestGitHub)' == '' AND '$(_NoGitLt10)' == 'true' AND Exists('$(_Tp10GitHub)')">$(_Tp10GitHub)</_TrellisNearestGitHub>
#
Enable central package transitive pinning

Set CentralPackageTransitivePinningEnabled to true in Directory.Packages.props to allow overriding transitively-resolved package versions, enabling pinning of vulnerable dependencies to patched versions.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.52%. Comparing base (7f3e6ce) to head (c496ad8).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
+ Coverage   83.37%   83.52%   +0.15%     
==========================================
  Files          24       24              
  Lines         439      443       +4     
  Branches       68       70       +2     
==========================================
+ Hits          366      370       +4     
  Misses         56       56              
  Partials       17       17              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xavierjohn xavierjohn merged commit 25622c6 into main Jul 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants