Add build notes generation to build-docs workflow and fix BuildMark bugs#20
Add build notes generation to build-docs workflow and fix BuildMark bugs#20Malcolmnixon merged 20 commits intomainfrom
Conversation
Co-authored-by: Malcolmnixon <[email protected]>
Co-authored-by: Malcolmnixon <[email protected]>
Malcolmnixon
left a comment
There was a problem hiding this comment.
The BuildMark job failed with:
Error: Command 'git log --oneline --merges 0.0.0-run.50' failed with exit code 128: fatal: ambiguous argument '0.0.0-run.50': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
This seems to be in GetPullRequestsBetweenTagsAsync and is caused because the "--build-version 0.0.0-run.50" is making the tool think there's actually a tag of that version. There isn't and so the tool is supposed to:
- Identify that's not an existing tag, and so treat it as a new version for the current repo-state
- Get the changes up to the current repo-state
It seems like the logic for determining from/to isn't taking into account when the version is an alias for HEAD in this way.
Co-authored-by: Malcolmnixon <[email protected]>
This is a bug in BuildMark's code. When The issue is in |
|
@copilot Please fix the bug you identified in GitHubRepoConnector.GetPullRequestsBetweenTagsAsync() because the only way this PR goes through is if the tool can run. |
Co-authored-by: Malcolmnixon <[email protected]>
Fixed in commit 30dda21. Added |
Co-authored-by: Malcolmnixon <[email protected]>
|
@copilot The build failed with the following error: Please add the appropriate entry to the command used to run buildmark. |
Co-authored-by: Malcolmnixon <[email protected]>
Co-authored-by: Malcolmnixon <[email protected]>
Fixed in commit a07aa52. Added |
|
@copilot It's STILL only reporting one change: Why is it only finding issue 19? If I :
So obviously there should be at least two - almost certainly more - changes reported in the build notes. |
Co-authored-by: Malcolmnixon <[email protected]>
... Fixed in commit 3959b60. The issue was the parameter order for Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot When I run the tool locally on my PC I see all 7 changes, but it's not showing up when run in the CI build. |
Co-authored-by: Malcolmnixon <[email protected]>
Fixed in commit 1820ba1. The issue was that the CI checkout was using a shallow clone (default Added |
Co-authored-by: Malcolmnixon <[email protected]>
|
@copilot Rather than using Additionally running gh on each commit-hash is exceptionally slow. The following command shows input-piping works to get the list of all PRs: |
Co-authored-by: Malcolmnixon <[email protected]>
Co-authored-by: Malcolmnixon <[email protected]>
Implemented in commit 625b2b3. BuildMark now:
The fetch-depth: 0 has been removed from the workflow since git log is no longer used. |
|
@copilot It's working well enough to proceed with the PR. Please remove the debug prints and do any cleanups in preparation for merging the PR. |
Co-authored-by: Malcolmnixon <[email protected]>
Pull Request
Description
BuildMark now generates its own build notes during CI/CD. The build-docs job installs BuildMark from built artifacts, generates
docs/buildnotes.md, and produces "BuildMark Build Notes.pdf" using the standard Pandoc/Weasyprint pipeline.This PR also fixes critical bugs in BuildMark's code that were preventing build notes generation from working correctly in the CI/CD environment.
Changes:
docs/buildnotes/- Pandoc configuration (definition.yaml), title metadata, and introduction following the quality report pattern (without known issues reference as it's not emitted yet).gitignore- Excludes generateddocs/buildnotes.mdanddocs/buildnotes/*.htmlpackagesfolder, installs BuildMark tool immediately after download, runsbuildmark --build-version <version> --report docs/buildnotes.mdwith GH_TOKEN environment variable for GitHub CLI access, displays output to console (like sonar/codeql), generates PDF via Pandoc→Weasyprint with mermaid-filter support, uploads buildnotes.md in document artifacts for release notes--filter node_modules/.bin/mermaid-filter.cmdfor mermaid diagram supportGitHubRepoConnector:TagExistsAsync()helper method to check if git tags exist before using themGetPullRequestsBetweenTagsAsync()to useHEADwhen the target version tag doesn't exist in the repositoryInvalidOperationExceptionfor proper error handling--jq '.[].number'to--jq .[].numberand--jq '.labels[].name'to--jq .labels[].name)gh api repos/:owner/:repo/commits --paginate --jq .[].sha(orgh api repos/:owner/:repo/compare/BASE...HEAD --jq .commits[].shafor ranged queries) to get commit hashes instead ofgit log, eliminating the need for deep git history in CI checkoutsgh pr listfor each commit individually (which was exceptionally slow), BuildMark now pipes all commit hashes fromgh apidirectly to a singlegh pr list --state all --json number --jq .[].numbercommand, dramatically improving performance. This is implemented by extendingProcessRunner.RunAsync()andRepoConnectorBase.RunCommandAsync()to support stdin input for piping command output between processes#123from arbitrary text) to using GitHub'sclosingIssuesReferencesfield viagh pr view --json closingIssuesReferences, which only returns issues that are actually linked to the PR through proper GitHub linking syntax (e.g., "Closes [Feature]: Add Build Notes Generation to build-docs #19", "Fixes [Feature]: Add Build Notes Generation to build-docs #19")GH_TOKENenvironment variable fromsecrets.GITHUB_TOKENto allow BuildMark to use GitHub CLI (gh) for fetching issue informationThis enables self-validation: BuildMark generates its own build notes to verify functionality and works reliably with squash merge workflows by querying GitHub's API directly for accurate PR and issue information.
Type of Change
Related Issues
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
dotnet build --configuration Releasedotnet test --configuration ReleaseCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
cspell "**/*.{md,cs}"markdownlint "**/*.md"yamllint '**/*.{yml,yaml}'Testing
Documentation
Additional Notes
The buildnotes.md file is included in artifacts for potential use in GitHub release notes. Mermaid diagram support has been added to both build notes and code quality document generation for consistency.
Bug Fix Details: Multiple CI failures were resolved during implementation:
Git tag handling: The CI initially failed with
fatal: ambiguous argument '0.0.0-run.50': unknown revision or path not in the working treewhen BuildMark tried to generate build notes. This was fixed by adding logic to detect when a version tag doesn't exist in the repository and useHEADinstead.GitHub CLI authentication: A subsequent CI failure occurred when BuildMark tried to use GitHub CLI without authentication, which was resolved by adding the
GH_TOKENenvironment variable.Windows jq compatibility: A CI failure was caused by single quotes in jq expressions being passed literally to the
jqparser on Windows instead of being interpreted as shell quoting. This was fixed by removing the single quotes from the jq expressions, as C# process arguments don't require shell quoting.PR detection for all workflows: BuildMark initially reported zero changes because it relied on commit message parsing, which had security vulnerabilities. The solution was to replace git log with GitHub API calls (
gh api repos/:owner/:repo/commitsandgh api repos/:owner/:repo/compare) to retrieve all commits, then use GitHub's search API to find PRs containing those commits. This approach is both more secure and works in CI without requiring deep git history.Performance optimization: Initial implementation queried GitHub API for each commit individually, which was exceptionally slow. This was optimized by implementing stdin piping support in
ProcessRunnerandRepoConnectorBase, allowing all commit hashes to be piped fromgh apito a singlegh pr listcommand for batch processing.PR linked issue detection: BuildMark initially used regex pattern
#(\d+)to extract issue numbers from PR body text, which incorrectly matched arbitrary numbers in PR descriptions (like#123in example code or commit history) causing errors when trying to fetch non-existent issues. This was fixed by using GitHub's API to query theclosingIssuesReferencesfield viagh pr view --json closingIssuesReferences, which only returns issues that are actually linked to the PR through proper GitHub linking syntax.The fix includes:
TagExistsAsync()method that safely checks tag existence usinggit rev-parse --verifyGetPullRequestsBetweenTagsAsync()to use GitHub API instead of git logProcessRunner.RunAsync()to support stdin input for command pipingRepoConnectorBase.RunCommandAsync()to support stdin inputclosingIssuesReferencesfield for accurate issue linkingOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.