Skip to content

feat: automate versioned CLI command documentation scaffolding and changelog engine#43

Merged
utkarsh232005 merged 23 commits into
KDM-cli:mainfrom
Yuvraj-Sarathe:feat/changelog-auto-workflow
May 17, 2026
Merged

feat: automate versioned CLI command documentation scaffolding and changelog engine#43
utkarsh232005 merged 23 commits into
KDM-cli:mainfrom
Yuvraj-Sarathe:feat/changelog-auto-workflow

Conversation

@Yuvraj-Sarathe
Copy link
Copy Markdown
Member

@Yuvraj-Sarathe Yuvraj-Sarathe commented May 17, 2026

Issue fixed

Issue #30


📝 Description

This PR introduces a fully automated, CI/CD-driven documentation management framework. It shifts the burden of manually creating changelogs and version-specific directory trees away from core developers and delegates it completely to a high-performance GitHub Actions pipeline.

Instead of maintaining a massive, monolithic root-level CHANGELOG.md file (which is prone to nasty merge conflicts during parallel feature development), this automation dynamically scaffolds isolated versioned workspaces (e.g., docs/v2.1.2/) directly on release events.


🛠️ What This PR Actually Does

1. The Scaffolding Pipeline (.github/workflows/changelog.yml)

We built a durable shell automation script that intercepts official repository releases and tag pushes (v*.*.*). The runner completely bypasses standard pipeline failures like detached HEAD states or non-fast-forward push blocks by explicitly aligning its workspace tracking pointers to the default branch before compiling code.

2. Master Blueprint System (.github/docs-template/)

We initialized a centralized blueprint layout that perfectly mirrors the recently adopted structure seen in the v1.2.1 tracking directory. It includes the mandatory subdirectories:

  • config/
  • health/
  • logs/
  • show/
  • watch/

3. Automated Lifecycle & Metadata Injection

Every time a new version tag is launched, the bot executes the following internal runtime sequence:

  1. Directory Branching: Generates a clean directory matching the version footprint (e.g., docs/v2.1.3/).
  2. Template Expansion: Deep-copies the entire master layout from .github/docs-template/ into the new version directory.
  3. Strict Metadata Stamping: Recursively scans every copied Markdown file and appends the mandatory Version: vX.X.X payload right to the bottom of the document footer automatically.
  4. Contextual Indexing: Collects all commits between the new tag and the previous tag using the mikepenz/release-changelog-builder-action engine, categorizes them according to Conventional Commits rules, and outputs them as the root README.md for that specific version folder.

📂 Target Project Directory Layout After A Release Run

Once this automation executes for a hypothetical v2.1.3 release, the docs/ folder structure scales perfectly without human configuration:

docs/
├── v1.2.1/                 # Historical manual release
└── v2.1.3/                 # <--- COMPLETELY GENERATED BY THE BOT
    ├── config/
    ├── health/
    ├── logs/
    ├── show/
    ├── watch/
    └── README.md           # Contains the auto-generated release notes/changelog


⚙️ How to Maintain & Update Command Docs (For Developers)

As the CLI tool evolves, updating the baseline documentation for new features is straightforward:

  1. Modify the Master Template: If you add a new command or edit parameters for an existing one, update the markdown files inside .github/docs-template/.
  2. Add New Subcategories: If a new core service is built, simply add a folder inside .github/docs-template/.
  3. Automatic Inheritance: When the next version is released, the pipeline will capture your template updates and duplicate them into the new version directory automatically.

⚠️ Checklist: Things You MUST Do Manually (Repository Owner Actions Required)

GitHub isolates permissions for third-party security actions. To ensure this automation functions without throwing execution code errors, the repository maintainer must complete these two administrative configurations manually:

1. Enable Read/Write Permissions for the Workflow Token

By default, GitHub blocks background actions from committing code back to your branch. You must give the system write access:

  • Go to the repository Settings (gear icon) -> Actions -> General.
  • Scroll to the very bottom to find the Workflow permissions block.
  • Change the option from "Read repository contents and packages permissions" to "Read and write permissions".
  • Click the green Save button.

2. Backfill Existing Content Inside the Master Template

The master template (.github/docs-template/) currently contains the clean folder structures matching v1.2.1 alongside empty placeholder files.

  • Before deploying a brand-new production release, copy the actual text contents of your command guides (like the setup markdown files or parameter descriptions) from your docs/v1.2.1/ folder right into the corresponding paths inside .github/docs-template/.
  • This ensures that when the next release drops, the bot clones fully completed informational guides instead of empty placeholder layouts.

Summary by CodeRabbit

  • Chores
    • Added an automated workflow that runs on releases to generate changelog content and prepare versioned documentation.
    • Creates a versioned documentation directory from a template when available, or scaffolds a fallback structure if not.
    • Inserts version metadata into documents and generates a version-specific README with changelog and publish date.
    • Commits and pushes generated docs back to the default branch, skipping commit if there are no changes.

Review Change Stack

@github-actions github-actions Bot added ci/cd documentation Improvements or additions to documentation labels May 17, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that generates categorized changelogs, scaffolds versioned docs under docs/${VERSION} (from a template or fallback), injects per-file **Version:** ${VERSION} markers when absent, writes a versioned README with changelog and metadata, and commits the docs to the default branch.

Release Changelog and Versioned Documentation Workflow

Layer / File(s) Summary
Triggers and checkout
.github/workflows/changelog.yml
Workflow triggers on release events and v*.*.* tag pushes, sets job concurrency and contents: write permission, and checks out the default branch with full history.
Changelog action configuration
.github/workflows/changelog.yml
Runs mikepenz/release-changelog-builder-action with category-to-label mappings (Features/Fixes/Improvements/Documentation) and forwards GITHUB_TOKEN to obtain changelog output.
Docs scaffold and README generation
.github/workflows/changelog.yml
Computes VERSION from the ref name, copies .github/docs-template (including dotfiles) or builds a fallback docs/${VERSION} structure, injects **Version:** ${VERSION} into Markdown files missing it, and writes docs/${VERSION}/README.md with header, published date, and changelog content (combined from $CHANGELOG and action output).
Commit and push docs changes
.github/workflows/changelog.yml
Configures the Actions bot git identity, stages docs/, exits if no changes, otherwise commits with [skip ci] and pushes the updates to the default branch.
sequenceDiagram
  participant GitHub as GitHub Events
  participant Workflow as Changelog Workflow
  participant Builder as release-changelog-builder
  participant FS as Repository Filesystem
  participant Git as Git Push

  GitHub->>Workflow: release published / tag push (v*.*.*)
  Workflow->>Builder: run changelog builder (with categories)
  Builder-->>Workflow: generated changelog text
  Workflow->>FS: create docs/${VERSION} (copy template or fallback)
  Workflow->>FS: inject **Version:** ${VERSION} into Markdown files
  Workflow->>FS: write docs/${VERSION}/README.md (changelog + metadata)
  Workflow->>Git: commit and push docs/ to default branch
Loading

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

📦 A tag flies by, the changelog wakes,
Templates copied, and version marks placed,
README filled with notes of release,
A bot signs off, the docs find their peace,
Versions preserved, history embraced.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: automating versioned CLI documentation scaffolding and changelog generation via a new GitHub Actions workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 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/changelog.yml:
- Around line 11-12: The generate-changelog job lacks explicit token permissions
for repo writes; update the workflow to request the required permission by
adding a permissions block that grants contents: write (e.g., add "permissions:
contents: write" at the job or workflow level) so the job (generate-changelog)
can push changes using the GITHUB_TOKEN; ensure the permissions block is placed
alongside the job definition and not nested inside a step.
- Around line 46-48: The cp command fails when TEMPLATE_DIR exists but is empty;
change the step to only run cp when the glob matches entries—e.g., test for
entries with compgen -G "$TEMPLATE_DIR"/* (or use a for loop with bash nullglob)
and only then run cp -r "$TEMPLATE_DIR"/* "$TARGET_DIR"/; this keeps the
existing variables TEMPLATE_DIR and TARGET_DIR and ensures the job does not
abort when the template directory is empty.
- Around line 56-57: The fallback directory creation currently uses TARGET_DIR
with subdirs "config", "runner", "docker", "kubernetes", "monitoring" which
doesn't match the documented template contract; update the mkdir -p invocation
that uses TARGET_DIR so it creates "config", "health", "logs", "show", and
"watch" (i.e., mkdir -p "$TARGET_DIR/config" "$TARGET_DIR/health"
"$TARGET_DIR/logs" "$TARGET_DIR/show" "$TARGET_DIR/watch") to ensure the
fallback layout matches the PR-specified template contract and produces
consistent versioned docs.
- Around line 77-80: Before running the git commit/push steps, detect whether
there are any staged changes under the docs path and skip the commit/push if
none exist: add a pre-check (e.g., using a staged-diff check like `git diff
--cached` or `git status --porcelain` scoped to docs/) and only run `git commit
-m "..."` and `git push origin HEAD:${{ github.event.repository.default_branch
}}` when that check finds changes; if no changes, log/echo a message and exit
successfully so the workflow does not fail.
- Around line 50-53: The current find ... -exec sh -c block appends the version
footer unconditionally, causing duplicates; update that shell snippet (the sh -c
executed by find that references TARGET_DIR and VERSION and uses echo) to first
detect and remove or skip existing version footers before appending: for each
file, check for an existing footer matching the version block (e.g., a trailing
"\n---\n**Version:** <VERSION>" or any "\n---\n**Version:**" block) using
grep/sed/awk, remove the old footer if present (or skip appending when it
already matches VERSION), and only then append the new footer with echo —
implement this inside the same sh -c block so the operation is idempotent across
runs.
- Line 65: The workflow currently injects the generated changelog into a shell
command via echo -e "${{ steps.github_release.outputs.changelog }}" >>
"$VERSION_README", which risks command injection from changelog content; replace
this with a safe write that treats the changelog as data (not evaluated shell
input) — e.g., call a tool that accepts the changelog as a single argument
(printf with a %s format) or append using a quoted/heredoc literal so the
variable is not interpreted by the shell, or use a GitHub Action that writes
file content directly; update the step replacing the echo invocation with one of
these safe write methods to ensure the changelog is not executed.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1609d36c-812e-4ca4-b768-abede105bf73

📥 Commits

Reviewing files that changed from the base of the PR and between c8c40c7 and 39183f5.

⛔ Files ignored due to path filters (10)
  • .github/docs-template/README.md is excluded by none and included by none
  • .github/docs-template/config/README.md is excluded by none and included by none
  • .github/docs-template/health/README.md is excluded by none and included by none
  • .github/docs-template/logs/README.md is excluded by none and included by none
  • .github/docs-template/show/README.md is excluded by none and included by none
  • .github/docs-template/watch/README.md is excluded by none and included by none
  • README.md is excluded by none and included by none
  • docs/changelogs/v1.1.3.md is excluded by none and included by none
  • docs/changelogs/v1.2.0.md is excluded by none and included by none
  • docs/changelogs/v1.2.1.md is excluded by none and included by none
📒 Files selected for processing (1)
  • .github/workflows/changelog.yml

Comment thread .github/workflows/changelog.yml Outdated
Comment thread .github/workflows/changelog.yml Outdated
Comment thread .github/workflows/changelog.yml
Comment thread .github/workflows/changelog.yml Outdated
Comment thread .github/workflows/changelog.yml Outdated
Comment thread .github/workflows/changelog.yml
@Yuvraj-Sarathe
Copy link
Copy Markdown
Member Author

2 bots showing errors is an already existing issue and is unrelated to my PR.

In the failure log, .github/scripts/bot-on-pr-open.cjs failed with a MODULE_NOT_FOUND error because it failed to import ./helpers. This looks like an existing issue with the PR-opening bot script on the upstream repository, and is totally unrelated to the documentation scaffolding changes introduced in this patch.

The core Auto Changelog & Versioned Docs workflow itself is verified and ready for review!

Yuvraj-Sarathe and others added 5 commits May 17, 2026 17:05
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/changelog.yml:
- Around line 49-62: The script has two shell syntax errors: fix the
array-length check by replacing the invalid `${\`#template_items\`[@]}` with the
correct parameter expansion `${`#template_items`[@]}` when testing template_items,
and remove the duplicated trailing "' _ {} +" so the find -exec block ends with
a single properly quoted exec invocation (i.e., keep only one ' _ {} + after the
sh -c block); ensure the inner sh -c quoting around "$VERSION" remains intact
and the for-loop block is closed exactly once.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6d00d9f7-7f13-49e9-8b92-0e0595565f94

📥 Commits

Reviewing files that changed from the base of the PR and between 39183f5 and c78e8e7.

📒 Files selected for processing (1)
  • .github/workflows/changelog.yml

Comment thread .github/workflows/changelog.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
.github/workflows/changelog.yml (2)

70-73: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Write changelog content safely (no shell interpolation).

Line [73] injects ${{ steps.github_release.outputs.changelog }} directly into the shell script. Treat changelog text as data via an env var + printf. Also, Line [72] currently references $CHANGELOG without defining it in this step.

Suggested patch
       - name: Scaffold Versioned CLI Documentation System
+        env:
+          CHANGELOG: ${{ steps.github_release.outputs.changelog }}
         run: |
@@
           echo -e "# KDM CLI Documentation - ${VERSION}\n" > "$VERSION_README"
           echo -e "Published on: $(date +'%Y-%m-%d')\n" >> "$VERSION_README"
           printf '%s\n' "$CHANGELOG" >> "$VERSION_README"
-          echo -e "${{ steps.github_release.outputs.changelog }}" >> "$VERSION_README"
           printf '\n---\n**Version Information:** %s\n' "$VERSION" >> "$VERSION_README"
🤖 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/changelog.yml around lines 70 - 73, The step writes
changelog content unsafely by interpolating ${{
steps.github_release.outputs.changelog }} directly into the shell and using an
undefined $CHANGELOG; fix it by exporting the release changelog into an
environment variable (e.g. CHANGELOG) from the workflow step that runs the
script or by setting CHANGELOG="$(echo "${{
steps.github_release.outputs.changelog }}")" before writing the file, then use
printf '%s\n' "$CHANGELOG" >> "$VERSION_README" (and echo other static lines) so
all changelog content is treated as data and not subject to shell interpolation;
update usages of VERSION_README and CHANGELOG in the step accordingly.

51-62: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix broken Bash syntax in the template-copy block.

Line [51] uses invalid array-length expansion, and Line [62] has a stray duplicated find -exec terminator. This will break the run step before scaffolding completes.

Suggested patch
             shopt -s dotglob nullglob
             template_items=("$TEMPLATE_DIR"/*)
-            if [ ${`#template_items`[@]} -gt 0 ]; then
+            if [ ${`#template_items`[@]} -gt 0 ]; then
               cp -r "${template_items[@]}" "$TARGET_DIR"/
             fi
             # 3. Recursively inject the mandatory Version string into every markdown file copied
             find "$TARGET_DIR" -type f -name "*.md" -exec sh -c '
               for file; do
                 if ! grep -Fq "**Version:** '"$VERSION"'" "$file"; then
                   printf "\n---\n**Version:** %s\n" "'"$VERSION"'" >> "$file"
                 fi
               done
             ' _ {} +
-            ' _ {} +
🤖 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/changelog.yml around lines 51 - 62, The template-copy
block has broken Bash syntax: replace the invalid array-length expression
`${\`#template_items\`[@]}` with the correct `${`#template_items`[@]}` when
checking template_items, and remove the stray duplicated terminator "' _ {} +"
at the end of the find -exec invocation so the single find "$TARGET_DIR" -type f
-name "*.md" -exec sh -c '... ' _ {} + form is preserved; ensure variables
referenced inside the sh -c script (VERSION, file) remain properly quoted as in
the existing block.
🤖 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/changelog.yml:
- Line 24: Replace the mutable tag used in the workflow step that currently
reads uses: mikepenz/release-changelog-builder-action@v4 with the action pinned
to its full commit SHA; locate the workflow step referencing
mikepenz/release-changelog-builder-action and update the tag to the specific
commit SHA (e.g., @<full-commit-sha>) so the action is immutable and cannot be
changed by upstream tag updates.
- Around line 3-8: Add a top-level GitHub Actions concurrency stanza to
serialize runs for the same version: add a concurrency block (at workflow root)
with group set to an expression that resolves to the tag/version for both
events, e.g. group: "changelog-${{ github.event.release.tag_name || github.ref
}}" and set cancel-in-progress: false so runs queue instead of cancelling; this
ensures the release (release.published) and push (tags v*.*.*) triggers for the
same version cannot run concurrently and will be serialized.

---

Duplicate comments:
In @.github/workflows/changelog.yml:
- Around line 70-73: The step writes changelog content unsafely by interpolating
${{ steps.github_release.outputs.changelog }} directly into the shell and using
an undefined $CHANGELOG; fix it by exporting the release changelog into an
environment variable (e.g. CHANGELOG) from the workflow step that runs the
script or by setting CHANGELOG="$(echo "${{
steps.github_release.outputs.changelog }}")" before writing the file, then use
printf '%s\n' "$CHANGELOG" >> "$VERSION_README" (and echo other static lines) so
all changelog content is treated as data and not subject to shell interpolation;
update usages of VERSION_README and CHANGELOG in the step accordingly.
- Around line 51-62: The template-copy block has broken Bash syntax: replace the
invalid array-length expression `${\`#template_items\`[@]}` with the correct
`${`#template_items`[@]}` when checking template_items, and remove the stray
duplicated terminator "' _ {} +" at the end of the find -exec invocation so the
single find "$TARGET_DIR" -type f -name "*.md" -exec sh -c '... ' _ {} + form is
preserved; ensure variables referenced inside the sh -c script (VERSION, file)
remain properly quoted as in the existing block.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 028e8d0d-eca1-4abc-89df-94e7c1350d2d

📥 Commits

Reviewing files that changed from the base of the PR and between 406d7b8 and e32b666.

📒 Files selected for processing (1)
  • .github/workflows/changelog.yml

Comment thread .github/workflows/changelog.yml
Comment thread .github/workflows/changelog.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
.github/workflows/changelog.yml (1)

57-57: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Bash syntax error: backticks inside parameter expansion are invalid.

This issue was previously flagged and remains unresolved. The expression ${#template_items[@]} uses backticks around #template_items, which is invalid bash syntax. Backticks trigger command substitution and cannot be nested within ${} parameter expansion.

🐛 Proposed fix
-            if [ ${`#template_items`[@]} -gt 0 ]; then
+            if [ ${`#template_items`[@]} -gt 0 ]; then
🤖 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/changelog.yml at line 57, The bash condition is using
invalid backticks inside parameter expansion `${\`#template_items\`[@]}`;
replace it with the correct parameter expansion and quoting: use `if [
"${`#template_items`[@]}" -gt 0 ]; then` (i.e., remove backticks, put
`#template_items` directly inside `${}` and quote the expansion) so the test
correctly checks the array length of `template_items`.
🤖 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/changelog.yml:
- Around line 77-78: The step writes an undefined $CHANGELOG and reintroduces a
shell-injection vector by using echo with the raw GitHub Actions output
(steps.github_release.outputs.changelog); fix by adding CHANGELOG to the step's
env and removing the vulnerable echo line, and update the safe append to use the
defined env variable (CHANGELOG) with a non-evaluating writer (e.g., printf) to
append to VERSION_README so the changelog content is not passed through the
shell for execution.
- Line 10: Remove the spurious leading space before the YAML top-level key
"jobs:" so it is a top-level mapping (i.e., ensure "jobs:" has no preceding
indentation), which will restore valid workflow structure and allow the parser
to recognize the jobs mapping correctly.
- Around line 28-30: Replace the placeholder action ref in the GitHub Action
step that uses mikepenz/release-changelog-builder-action (the line starting with
"uses: mikepenz/release-changelog-builder-action@<full_commit_sha>") with the
actual v4 commit SHA by changing the reference to
"`@32e3c96f29a6532607f638797455e9e98cfc703d`"; ensure the "uses:" value exactly
matches
mikepenz/release-changelog-builder-action@32e3c96f29a6532607f638797455e9e98cfc703d
so the workflow runs against the known v4 commit.

---

Duplicate comments:
In @.github/workflows/changelog.yml:
- Line 57: The bash condition is using invalid backticks inside parameter
expansion `${\`#template_items\`[@]}`; replace it with the correct parameter
expansion and quoting: use `if [ "${`#template_items`[@]}" -gt 0 ]; then` (i.e.,
remove backticks, put `#template_items` directly inside `${}` and quote the
expansion) so the test correctly checks the array length of `template_items`.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c1233e3d-8e95-494e-aea7-f15fceac3563

📥 Commits

Reviewing files that changed from the base of the PR and between e32b666 and f051a33.

📒 Files selected for processing (1)
  • .github/workflows/changelog.yml

Comment thread .github/workflows/changelog.yml Outdated
Comment thread .github/workflows/changelog.yml Outdated
Comment thread .github/workflows/changelog.yml Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Updated changelog action to use specific commit SHA.
@Yuvraj-Sarathe
Copy link
Copy Markdown
Member Author

Resolved all errors and suggestions by CodeRabbit

ready to merge

Comment thread docs/changelogs/v1.1.3.md Outdated
Comment thread docs/changelogs/v1.2.0.md Outdated
Comment thread docs/changelogs/v1.2.1.md Outdated
Comment thread README.md
Comment thread .github/docs-template/README.md
Comment thread .github/workflows/changelog.yml
@utkarsh232005
Copy link
Copy Markdown
Member

utkarsh232005 commented May 17, 2026

@Yuvraj-Sarathe After this PR is merged, we would love to add you as a CODEOWNER for this workflow. This will allow you to handle its future maintenance and review any upcoming changes.Let us know if you're ready for this!

@Yuvraj-Sarathe
Copy link
Copy Markdown
Member Author

@Yuvraj-Sarathe After this PR is merged, we would love to add you as a CODEOWNER for this workflow. This will allow you to handle its future maintenance and review any upcoming changes.Let us know if you're ready for this!

I will be more than willing to play the role of that alongside trying to solve more issues.

However, we must first decide what we actually aim to do with this workflow.

I am referring to this: #43 (comment)

@Yuvraj-Sarathe
Copy link
Copy Markdown
Member Author

Let's get on the same page about the architecture before we start writing any code.

We need to make a decision on how to deal with the current PR. Depending on how we want to structure the automated docs, we will either merge this as a baseline, edit, or close it all together and start fresh.

Here is the proposed design to keep a flat file structure within the docs/ directory with no nested subfolders.

Proposed Structure

We automate generation of versioned markdown files (like v1.2.1.md) in the root docs/. The directory will look like this:

.
├── .github/                 
│   └── workflows/      
│       └── changelog.yml           
└── docs/               
    ├── README.md             -- The main landing page
    ├── v1.0.0.md             -- Historical release doc
    └── v1.2.1.md             -- Latest release doc

We have two options to implement the main docs/README.md landing page:

Option 1: My Suggestion

The README.md is automatically filled with the content of the latest release version and a section with links to historic versions. A user opening the folder immediately sees the current documentation without navigating away.

docs/README.md Template:

# Documentation (Latest: v1.2.1)

[Embedded content of v1.2.1.md]

---
## Version History
* [v1.2.1](v1.2.1.md)
* [v1.0.0](v1.0.0.md)

Option 2: Index Based Approach

The README.md acts strictly as an index page containing navigation links or UI badges pointing to specific version files.

docs/README.md Template:

# Project Documentation

Select a version to view its documentation:

* [![Version v1.2.1](https://img.shields.io/badge/docs-v1.2.1-blue)](v1.2.1.md) (Latest)
* [![Version v1.0.0](https://img.shields.io/badge/docs-v1.0.0-gray)](v1.0.0.md)

Note: Individual version files (like v1.2.1.md) will remain completely separated from others—they will only contain documentation relevant to that specific release, with no cross-links to past or future versions.


How to Proceed with this PR

  • If we choose a flat-file approach (Option 1 or 2): This current PR is obsolete because it doesn't align with the flat architecture. I will close this PR, scrap the current branch, and open a clean one tailored to the automated workflow.
  • If the current PR structure is acceptable: We can merge this baseline now. Future adjustments to the layout will be handled purely by updating the .github/workflows/changelog.yml file later.

Let me know which option you prefer so I can configure the automation tracking accordingly.

@utkarsh232005
Copy link
Copy Markdown
Member

utkarsh232005 commented May 17, 2026

Let's get on the same page about the architecture before we start writing any code.

We need to make a decision on how to deal with the current PR. Depending on how we want to structure the automated docs, we will either merge this as a baseline, edit, or close it all together and start fresh.

Here is the proposed design to keep a flat file structure within the docs/ directory with no nested subfolders.

Proposed Structure

We automate generation of versioned markdown files (like v1.2.1.md) in the root docs/. The directory will look like this:


.

├── .github/                 

│   └── workflows/      

│       └── changelog.yml           

└── docs/               

    ├── README.md             -- The main landing page

    ├── v1.0.0.md             -- Historical release doc

    └── v1.2.1.md             -- Latest release doc



We have two options to implement the main docs/README.md landing page:

Option 1: My Suggestion

The README.md is automatically filled with the content of the latest release version and a section with links to historic versions. A user opening the folder immediately sees the current documentation without navigating away.

docs/README.md Template:

# Documentation (Latest: v1.2.1)



[Embedded content of v1.2.1.md]



---

## Version History

* [v1.2.1](v1.2.1.md)

* [v1.0.0](v1.0.0.md)


Option 2: Index Based Approach

The README.md acts strictly as an index page containing navigation links or UI badges pointing to specific version files.

docs/README.md Template:

# Project Documentation



Select a version to view its documentation:



* [![Version v1.2.1](https://img.shields.io/badge/docs-v1.2.1-blue)](v1.2.1.md) (Latest)

* [![Version v1.0.0](https://img.shields.io/badge/docs-v1.0.0-gray)](v1.0.0.md)


Note: Individual version files (like v1.2.1.md) will remain completely separated from others—they will only contain documentation relevant to that specific release, with no cross-links to past or future versions.


How to Proceed with this PR

  • If we choose a flat-file approach (Option 1 or 2): This current PR is obsolete because it doesn't align with the flat architecture. I will close this PR, scrap the current branch, and open a clean one tailored to the automated workflow.

  • If the current PR structure is acceptable: We can merge this baseline now. Future adjustments to the layout will be handled purely by updating the .github/workflows/changelog.yml file later.

Let me know which option you prefer so I can configure the automation tracking accordingly.

Yes option 1 looks good rn i will merge it as is we can follow this architecture flow in new pr

@utkarsh232005
Copy link
Copy Markdown
Member

@Yuvraj-Sarathe reopen the pr as i will merge it make you codeowner of it then our decided new approach will be implemented on a new pr

@utkarsh232005 utkarsh232005 merged commit 72bdc83 into KDM-cli:main May 17, 2026
10 of 14 checks passed
@Yuvraj-Sarathe Yuvraj-Sarathe deleted the feat/changelog-auto-workflow branch May 17, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants