feat(docs): add api-docs template for dotnet-sdk (xmldocmd)#15
feat(docs): add api-docs template for dotnet-sdk (xmldocmd)#15WomB0ComB0 merged 5 commits intomainfrom
Conversation
Mirrors the TypeScript pipeline for .NET. Iterates over every IsPackable project in the solution, builds Release with GenerateDocumentationFile=true, then runs xmldocmd against each DLL/XML pair to produce a per-package Markdown tree. Reuses the same Mintlify-safety post-processing as the TypeScript template (./ prefix on bare-filename links, MDX curly-brace escape outside code regions) and opens a PR via peter-evans/create-pull-request authored as resq-sw. Picked xmldocmd over DocFX because DocFX's Markdown story requires a custom template; xmldocmd is purpose-built for the DLL+XML -> Markdown conversion with a single shell invocation.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request introduces a GitHub Actions workflow that automates .NET API documentation generation. The workflow checks out source, builds projects to generate XML docs, converts them to Markdown via Changes.NET API Documentation Automation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@automation/source-repo-templates/api-docs.dotnet.yml`:
- Around line 103-113: The current loop over PUBLIC_PROJECTS skips missing
assembly files with a warning which can lead to a destructive sync publishing
incomplete docs; modify the check around
dll="${proj}/bin/Release/net9.0/${proj}.dll" so that if [ ! -f "$dll" ] then
emit an error and exit with a non-zero status (fail the job) instead of
continuing, ensuring the workflow halts before the later destructive sync (see
the loop and the xmldocmd invocation that writes to OUTPUT_DIR/$proj); apply the
same failing behavior to the other similar check at lines 206-212.
- Around line 42-43: The workflow mixes github.ref/github.ref_name and
inputs.ref causing inconsistent branch names and PR collisions; resolve the
requested ref once (e.g., compute a single resolved_ref from inputs.ref ||
github.ref_name in a step or job-level env) and use that resolved_ref
everywhere—replace group: api-docs-${{ github.ref }}, the checkout step(s) that
currently use inputs.ref, and the PR/branch name construction (the logic around
creating the docs PR branch) to reference the single resolved_ref variable
(e.g., env.RESOLVED_REF or a step output like steps.resolve_ref.outputs.ref) so
all metadata and branch names are consistent for workflow_dispatch and other
triggers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9afb5d79-b666-4e38-a5b7-094962818146
📒 Files selected for processing (2)
automation/source-repo-templates/README.mdautomation/source-repo-templates/api-docs.dotnet.yml
…semblies Resolves CodeRabbit review threads on PR #15: - Compute DOCS_REF_NAME / DOCS_REF_SLUG once from inputs.ref || github.ref_name and use them for the docs PR commit message, title, body, and branch name. Also key the concurrency group off inputs.ref || github.ref so workflow_dispatch runs against alternate refs no longer collide with the default branch. - Track missing assemblies as errors and exit non-zero when any expected project DLL is absent or none were generated, so the later destructive sync into sdks/dotnet/api/ never publishes a partial API surface.
There was a problem hiding this comment.
Code Review
This pull request introduces a new GitHub Actions workflow template, api-docs.dotnet.yml, designed to automate the generation of .NET API documentation using xmldocmd. The workflow handles building the solution, generating Markdown documentation for public projects, and performing post-processing for MDX compatibility before opening a pull request in the central documentation repository. Feedback focuses on improving the template's maintainability and robustness by dynamically discovering packable projects and locating build artifacts instead of relying on hardcoded paths and project lists.
xmldocmd's first run on dotnet-sdk failed with FileNotFoundException for System.Runtime 9.0.0.0. Root cause: xmldocmd uses MetadataLoadContext to read assembly metadata, and its resolver scans only the directory of the target DLL for referenced assemblies. `dotnet build` for class libraries does not copy transitive package/contract assemblies into bin; only `dotnet publish` does. Add an explicit publish pass per project after build. xmldocmd then reads from bin/Release/net9.0/publish/<Project>.dll where the full dependency closure is sitting next to the target.
Sync source-of-truth template (resq-software/docs#15) updates: * Add a publish step after build. xmldocmd uses MetadataLoadContext which scans only the directory of the target DLL for referenced assemblies. `dotnet build` for class libraries does not copy transitive contract assemblies (e.g. System.Runtime); `dotnet publish` does. Point xmldocmd at bin/Release/net9.0/publish/. * Resolve the source ref once into DOCS_REF_NAME / DOCS_REF_SLUG so workflow_dispatch with an alternate ref consistently flows through PR/branch names without /-vs-tag inconsistencies. * Use `set -euo pipefail` and fail the run if any project's assembly is missing or zero packages produced output. Avoids syncing partial/empty docs output to the docs repo. First run (https://github.com/resq-software/dotnet-sdk/actions/runs/25590261716) failed at xmldocmd with FileNotFoundException for System.Runtime 9.0.0.0; this addresses the root cause.
) Sync source-of-truth template (resq-software/docs#15) updates: * Add a publish step after build. xmldocmd uses MetadataLoadContext which scans only the directory of the target DLL for referenced assemblies. `dotnet build` for class libraries does not copy transitive contract assemblies (e.g. System.Runtime); `dotnet publish` does. Point xmldocmd at bin/Release/net9.0/publish/. * Resolve the source ref once into DOCS_REF_NAME / DOCS_REF_SLUG so workflow_dispatch with an alternate ref consistently flows through PR/branch names without /-vs-tag inconsistencies. * Use `set -euo pipefail` and fail the run if any project's assembly is missing or zero packages produced output. Avoids syncing partial/empty docs output to the docs repo. First run (https://github.com/resq-software/dotnet-sdk/actions/runs/25590261716) failed at xmldocmd with FileNotFoundException for System.Runtime 9.0.0.0; this addresses the root cause.
xmldocmd uses MetadataLoadContext to read assembly metadata, and its PathAssemblyResolver scans only the directory of the target DLL for transitive dependencies. .NET 9 class library output does not include System.Runtime contract DLLs even after dotnet publish, so xmldocmd hits FileNotFoundException for every loaded assembly: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=9.0.0.0, ...' DefaultDocumentation.Console reads with Mono.Cecil, which parses the assembly bytes directly without resolving against a runtime, so cross-version reads just work. Drop the now-unnecessary publish step and update the per-language tooling table.
Addresses pr#15 review feedback. global.json pins the SDK feature band but not the project TFM. Replacing bin/Release/net9.0/<Project>.dll with a `find` over `bin/Release/*/` lets a net10 upgrade roll through without a workflow edit.
Mintlify's URL parser splits link targets at the first '#'. DefaultDocumentation names constructor pages '<Type>.#ctor.md' following the IL convention, so a link like Foo.#ctor.md#Foo.Foo(string) parses as path='Foo.' (does not exist) and fragment='ctor.md#...'. Rename '*.#ctor.md' -> '*.ctor.md' and rewrite the substring '.#ctor.md' in all remaining content. Sync source-of-truth from resq-software/docs#15.
Mintlify's URL parser splits link targets at the first '#'. DefaultDocumentation names constructor pages '<Type>.#ctor.md' following the IL convention, so a link like Foo.#ctor.md#Foo.Foo(string) parses as path='Foo.' (does not exist) and fragment='ctor.md#...'. Rename '*.#ctor.md' -> '*.ctor.md' and rewrite the substring '.#ctor.md' in all remaining content. Sync source-of-truth from resq-software/docs#15.
Summary
Adds the second per-language workflow template, mirroring the TypeScript pipeline for .NET.
automation/source-repo-templates/api-docs.dotnet.ymldotnet-sdkrow updated fromDocFX / _TODO_placeholder toxmldocmd / api-docs.dotnet.ymlPipeline
actions/setup-dotnethonoringglobal.json(.NET 9 today).dotnet build -c Release -p:GenerateDocumentationFile=trueto emit the per-project XML doc files alongside DLLs.dotnet tool install -g xmldocmdthen iterate over six packable projects (ResQ.Clients,ResQ.Core,ResQ.Protocols,ResQ.Blockchain,ResQ.Storage,ResQ.Simulation), invokingxmldocmd <dll> <out>/<proj> --visibility public --clean../prefix on bare-filename.mdlinkspeter-evans/create-pull-requestopens a PR back toresq-software/docsagainstmain, branchauto/dotnet-api-<ref>, authored asresq-sw.Why xmldocmd over DocFX
xmldocmd is a purpose-built CLI tool that takes a DLL + XML pair and produces Markdown. DocFX is more powerful but its Markdown output requires a custom template (its native output is HTML). For the simpler shape we want, xmldocmd is one-step.
Test plan
resq-software/dotnet-sdkcopying this file to.github/workflows/api-docs.yml.workflow_dispatchand inspect the resulting docs PR for unexpected post-processing failures.Out of scope
sdks/dotnet/api/indocs.json(deferred along with the TypeScript nav).Summary by CodeRabbit
Documentation
Automation