feat: add rpk documentation automation#1733
Conversation
✅ Deploy Preview for redpanda-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR introduces a complete system for customizing auto-generated rpk CLI documentation through JSON-based overrides. It adds a directory structure guide, a comprehensive JSON Schema defining the override format, a detailed user guide explaining how to use overrides, and a GitHub Actions workflow that automates documentation generation and pull request creation with parsed diff summaries. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 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 |
f8c7f20 to
6f87a4e
Compare
Add the infrastructure for automated rpk CLI documentation generation. Does not include generated pages - those will be created by running the workflow after merge. ## New files - `.github/workflows/update-rpk-docs.yml` - GitHub Action for automated updates - `docs-data/rpk-overrides.json` - Writer override configuration - `docs-data/rpk-overrides.schema.json` - JSON Schema for validation - `docs-data/RPK_OVERRIDES_GUIDE.adoc` - Writer guide for customization - `docs-data/README.adoc` - Directory reference ## Workflow features - Manual trigger via workflow_dispatch - Cross-repo trigger via repository_dispatch - Automatic PR creation with diff summary - Support for version tags and dev branch ## Excluded commands - `rpk ai *` - 41 commands marked "coming soon" - `rpk oxla` - Marked "coming soon" Related: redpanda-data/docs-extensions-and-macros#203
6f87a4e to
9c868ee
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/update-rpk-docs.yml (1)
30-30: ⚡ Quick winPin GitHub Actions to commit SHAs for supply chain security.
Actions are referenced by mutable tags (
@v4,@v5,@v6) which can be updated by action maintainers. Pinning to immutable commit SHAs prevents supply chain attacks where action tags are compromised.Example pins for current stable versions:
actions/checkout@v4→actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2actions/setup-node@v4→actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af# v4.1.0actions/setup-go@v5→actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a# v5.2.0peter-evans/create-pull-request@v6→peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f# v7.0.5Verify current SHA pins before applying.
Also applies to: 35-35, 44-44, 210-210
🤖 Prompt for 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. In @.github/workflows/update-rpk-docs.yml at line 30, The workflow references mutable action tags like actions/checkout@v4, actions/setup-node@v4, actions/setup-go@v5, and peter-evans/create-pull-request@v6; replace those tag references with their corresponding immutable commit SHAs (e.g., actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683, actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af, actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a, peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f) and verify the current stable SHA for each action before applying the change so the workflow uses immutable pins for supply-chain security.
🤖 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 @.github/workflows/update-rpk-docs.yml:
- Around line 29-32: The checkout step labeled "Checkout docs repo" (uses:
actions/checkout@v4) is missing persist-credentials control; modify that step to
add persist-credentials: false under its with block to ensure the GITHUB_TOKEN
is not persisted to the checked-out repo and cannot leak to subsequent steps or
git operations.
- Around line 48-71: The step is vulnerable because it directly interpolates
user-controlled inputs into shell assignments (VERSION, DIFF_VERSION,
DRAFT_MISSING, branch_name); instead validate and sanitize those inputs before
use: explicitly read the incoming values into safe variables, validate VERSION
against an allowlist/regex (e.g. semantic version or "dev"), normalize/whitelist
DIFF_VERSION and DRAFT_MISSING (accept only expected patterns like digits or
"true"/"false"), and reject or fallback to safe defaults for anything else;
construct branch_name from the validated VERSION only (no raw string
concatenation of untrusted input) and prefer assigning values via the GitHub
Actions env/outputs mechanism rather than unquoted shell expansion so no user
payload can inject commands.
- Around line 102-107: Remove the redundant file-existence test that uses `[ -f
"docs-data/rpk-diff-*.json" ]`; instead keep the existing discovery using
`DIFF_FILE=$(ls -t docs-data/rpk-diff-*.json 2>/dev/null | head -1)` and the
subsequent `if [ -n "$DIFF_FILE" ]; then echo "diff_file=$DIFF_FILE" >>
$GITHUB_OUTPUT; fi` logic so the script relies on `ls` to find the latest
matching `docs-data/rpk-diff-*.json` file and only emits to `GITHUB_OUTPUT` when
`DIFF_FILE` is non-empty (remove the outer `if [ -f ... ]; then` and its
matching `fi`).
---
Nitpick comments:
In @.github/workflows/update-rpk-docs.yml:
- Line 30: The workflow references mutable action tags like actions/checkout@v4,
actions/setup-node@v4, actions/setup-go@v5, and
peter-evans/create-pull-request@v6; replace those tag references with their
corresponding immutable commit SHAs (e.g.,
actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683,
actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af,
actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a,
peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f) and
verify the current stable SHA for each action before applying the change so the
workflow uses immutable pins for supply-chain security.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2516b58b-06c0-462f-88ec-8c6809c42486
📒 Files selected for processing (5)
.github/workflows/update-rpk-docs.ymldocs-data/README.adocdocs-data/RPK_OVERRIDES_GUIDE.adocdocs-data/rpk-overrides.jsondocs-data/rpk-overrides.schema.json
Add the infrastructure for automated rpk CLI documentation generation. Does not include generated pages - those will be created by running the workflow after merge. - `.github/workflows/update-rpk-docs.yml` - GitHub Action for automated updates - `docs-data/rpk-overrides.json` - Writer override configuration - `docs-data/rpk-overrides.schema.json` - JSON Schema for validation - `docs-data/RPK_OVERRIDES_GUIDE.adoc` - Writer guide for customization - `docs-data/README.adoc` - Directory reference - Manual trigger via workflow_dispatch - Cross-repo trigger via repository_dispatch - Automatic PR creation with diff summary - Support for version tags and dev branch - `rpk ai *` - 41 commands marked "coming soon" - `rpk oxla` - Marked "coming soon" Related: redpanda-data/docs-extensions-and-macros#203
- Remove redundant "NOTE:" prefix from content in type: "note" items (template already adds the prefix) - Add safety net text transformations for duplicate admonitions Fixes: - rpk security acl create: "NOTE: NOTE:" → "NOTE:" - rpk cluster self-test start: "NOTE: NOTE:" → "NOTE:" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
c85e851 to
371ce42
Compare
Capture Michele's editorial improvements for rpk ai commands while keeping them excluded. Content will be used when exclusions are removed. - rpk ai llm: supported provider types - rpk ai model: catalog behavior explanation - rpk ai oauth: OAuth provider purpose - rpk ai oauth-client: OAuthClient explanation and client_secret behavior Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When running with --diff, automatically update the what's-new file with new rpk commands, flags, and changed defaults. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Detect RC versions (e.g., v26.2.0-rc1) - Validate RC version matches beta branch antora.yml version - Create PRs against beta branch for RC releases - Regular releases continue targeting main branch Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR ReviewFiles reviewed: 2 What this PR doesAdds the infrastructure to automatically generate rpk CLI documentation: a GitHub Actions workflow (triggerable manually or via Jira ticket alignmentTicket: Not referenced directly in the PR title/body. Linked dependency is docs-extensions-and-macros#203 ("DOC-2220: comprehensive rpk documentation automation system"), which is still OPEN, not merged. Critical issues (must fix)
Suggestions (should consider)
Impact on other files
CodeRabbit findings worth consideringAll four are surfaced above. The template injection one (critical) is the most important — that's a real CI security issue, not a style preference. The other three ( What works well
🤖 Generated with Claude Code via |
Summary
Add the infrastructure for automated rpk CLI documentation generation. Does not include generated pages - those will be created by running the workflow after merge.
Dependencies
Requires: redpanda-data/docs-extensions-and-macros#203 - The rpk-docs generator tool
What's included
GitHub Action workflow
.github/workflows/update-rpk-docs.yml- Automated documentation updates:repository_dispatchWriter override system
docs-data/rpk-overrides.json- Customize auto-generated content:Documentation
docs-data/RPK_OVERRIDES_GUIDE.adoc- Complete guide for writersdocs-data/README.adoc- Directory referencedocs-data/rpk-overrides.schema.json- JSON Schema for editor validationExcluded commands
The following commands are excluded from generation (marked "coming soon"):
rpk ai *- 41 commandsrpk oxla- 1 commandUsage after merge
Generate docs via workflow:
v26.2.0ordev)Generate docs locally:
Test plan
actdry run