Update API reference copy to nearest .github in repo#41
Merged
Conversation
Refactor Trellis.ApiReference.targets to copy API reference markdown files to the nearest existing .github directory up to the .git repo root, rather than always using the repo root. Falls back to creating .github at the repo root if none exists. Improves flexibility for multi-project repos and ensures files are only copied within the intended repository boundary. Updates comments and variable names for clarity.
There was a problem hiding this comment.
Pull request overview
This PR refactors the packaged MSBuild targets used for syncing Trellis API reference markdown into a repository’s .github/ folder, so the destination is the nearest existing .github directory when walking upward from the project directory, bounded by the nearest .git repo root (with a fallback to creating .github/ at the repo root). This improves behavior in multi-project / nested-repo layouts while preventing copies from escaping the repository boundary.
Changes:
- Change destination resolution to prefer the nearest existing
.github/directory between the project and the.gitrepo root. - Add explicit repo-boundary guarding logic to avoid selecting a
.github/directory above the discovered.gitroot. - Rename/adjust internal properties and comments for clarity (e.g.,
_TrellisOutputDir,_TrellisNearestGitHub, expanded explanation of the unrolled walk).
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.
Refactor Trellis.ApiReference.targets to copy API reference markdown files to the nearest existing .github directory up to the .git repo root, rather than always using the repo root. Falls back to creating .github at the repo root if none exists. Improves flexibility for multi-project repos and ensures files are only copied within the intended repository boundary. Updates comments and variable names for clarity.