-
Notifications
You must be signed in to change notification settings - Fork 90
fix: Support auto-generated CLI reference doc in the notation repo #1336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: Support auto-generated CLI reference doc in the notation repo #1336
Conversation
- Add GitHub workflow to auto-generate CLI docs when cmd/notation changes - Create doc.go with build tag for documentation generation - Refactor main.go to export NewRootCommand function - Add Makefile target 'cli-docs' for manual doc generation - Add docs/cli/ to .gitignore Implements auto-generation of CLI reference documentation similar to the minder project workflow. Documentation is generated using cobra/doc and creates markdown files for all CLI commands. Fixes notaryproject#859 Signed-off-by: majiayu000 <1835304752@qq.com>
There was a problem hiding this comment.
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 implements automatic generation of CLI reference documentation for the notation project. The implementation uses build tags to separate the documentation generation logic from the main CLI binary, and adds a GitHub Actions workflow that automatically creates pull requests when CLI commands are modified.
Key changes:
- Added GitHub workflow to auto-generate CLI documentation on changes to cmd/notation
- Introduced build tag separation (
gendocvs!gendoc) to enable dual-purpose main package usage - Refactored root command initialization into a reusable
NewRootCommand()function - Updated dependencies to include cobra/doc for markdown generation
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/update-docs-cli.yml | New workflow that triggers on cmd/notation changes and creates PRs with updated CLI docs |
| cmd/notation/doc.go | Documentation generation entry point using gendoc build tag |
| cmd/notation/main.go | Simplified to use NewRootCommand() with !gendoc build tag |
| cmd/notation/root.go | Extracted root command initialization logic for reuse |
| Makefile | Added cli-docs target for manual documentation generation |
| .gitignore | Excluded generated docs/cli directory from version control |
| go.mod | Updated cobra and pflag versions, added new indirect dependencies |
| go.sum | Updated checksums for new and upgraded dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
| github.com/veraison/go-cose v1.3.0 // indirect | ||
| github.com/x448/float16 v0.8.4 // indirect | ||
| go.yaml.in/yaml/v3 v3.0.4 // indirect |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import path go.yaml.in/yaml/v3 is incorrect. The correct import path for yaml.v3 is gopkg.in/yaml.v3. This appears to be introduced as an indirect dependency. Running go mod tidy should correct this to use the proper import path.
| go.yaml.in/yaml/v3 v3.0.4 // indirect | |
| gopkg.in/yaml.v3 v3.0.4 // indirect |
| go-version-file: 'go.mod' | ||
| check-latest: true | ||
|
|
||
| - name: Generate CLI documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where will the CLI reference doc to be generated? From the cmd/notation/doc.go, will the doc be generated in a new folder created in the notation repo?
FeynmanZhou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @majiayu000 .
Summary
This PR fixes #859
Changes
The workflow automatically creates a pull request when CLI commands change, similar to the minder project workflow referenced in the issue.
Testing
Generated with Claude Code