Skip to content

Auto-merge docs PRs, remove manual doc generation requirement - #507

Closed
stbenjam wants to merge 4 commits into
openshift-eng:mainfrom
stbenjam:auto-doc
Closed

stbenjam wants to merge 4 commits into
openshift-eng:mainfrom
stbenjam:auto-doc

Conversation

@stbenjam

@stbenjam stbenjam commented May 28, 2026

Copy link
Copy Markdown
Member

See: #487 (comment)

Summary

  • CI auto-generates docs on merge to main and enables auto-merge when the only file changed is docs/index.html
  • Removes the plugins-doc-up-to-date lint rule so contributors no longer need to run make update for docs
  • Adds make docs target for optional local preview
  • Updates CONTRIBUTING.md and AGENTS.md to reflect the new workflow

Prerequisite

Enable "Allow auto-merge" in repo Settings > General > Pull Requests.

Test plan

  • Merge a plugin change to main and verify the docs PR is created with auto-merge enabled
  • Verify make lint passes without docs/ being in sync
  • Verify make docs generates docs locally

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Documentation regeneration is now handled by CI after plugin changes are merged to main; local manual regeneration is no longer required.
    • Contribution docs updated to reflect the CI-managed docs workflow and adjusted local update ordering.
    • CI now auto-merges trivial documentation-only updates and prevents overlapping docs-update runs.

Contributors no longer need to run `make update` to regenerate docs.
CI handles doc generation on merge to main and auto-merges the
resulting PR when only docs/index.html is changed. A new `make docs`
target is available for local preview.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci
openshift-ci Bot requested review from cblecker and mrunalp May 28, 2026 13:40
@openshift-ci

openshift-ci Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stbenjam

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 28, 2026
stbenjam and others added 2 commits May 28, 2026 09:41
When multiple plugin PRs merge to main in quick succession, the
older workflow run could overwrite newer docs. Cancel in-progress
runs so only the latest commit's docs are generated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The rule file was deleted but its registration in .skillsaw.yaml
remained, causing the linter to crash with FileNotFoundError.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 94737fa3-0703-4134-bca6-25650fbf159e

📥 Commits

Reviewing files that changed from the base of the PR and between 5d5b07f and f959c4a.

📒 Files selected for processing (2)
  • .github/workflows/update-docs.yml
  • CONTRIBUTING.md
✅ Files skipped from review due to trivial changes (1)
  • CONTRIBUTING.md

Walkthrough

This PR shifts documentation regeneration to CI: the update-docs workflow now triggers on marketplace metadata changes, exposes the created PR id and auto-merges docs-only PRs; the local Skillsaw docs-freshness rule is removed; Makefile and contributor docs are updated to reflect CI-managed doc regeneration.

Changes

Shift Documentation Regeneration to CI Automation

Layer / File(s) Summary
GitHub workflow enhancement for docs-only PR auto-merge
.github/workflows/update-docs.yml
Workflow now watches .claude-plugin/marketplace.json, uses concurrency control, tags the PR creation step with id: create-pr, and auto-merges (squash) PRs when docs/index.html is the only changed file.
Remove local docs freshness validation rule
.skillsaw.yaml, .skillsaw/plugindocs_rule.py
Removes the .skillsaw/plugindocs_rule.py custom rule reference and associated implementation, disabling the local check that regenerated and compared docs/index.html.
Update local development instructions and build tooling
Makefile, CONTRIBUTING.md, AGENTS.md
The make update target now only fixes frontmatter and syncs marketplace versions (no docs generation). CONTRIBUTING/AGENTS reorder steps to run make update before make lint and state that CI regenerates docs on merge to main.

Sequence Diagram

sequenceDiagram
  participant GitHub as GitHub Trigger
  participant WF as update-docs Workflow
  participant CLI as GitHub CLI
  GitHub->>WF: push affecting marketplace.json or docs
  WF->>WF: create PR (id: create-pr)
  WF->>CLI: gh pr diff PR_NUMBER --name-only
  CLI-->>WF: changed files list
  alt Only docs/index.html changed
    WF->>CLI: gh pr merge PR_NUMBER --auto --squash
    CLI-->>GitHub: PR merged
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • mrunalp
  • cblecker
🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 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 changes: automating docs PR merging and removing the manual doc generation requirement from the contributor 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.
No Real People Names In Style References ✅ Passed No real people names used as style references found in PR changes. AGENTS.md actually adds a contributing rule explicitly prohibiting such references.
No Assumed Git Remote Names ✅ Passed PR contains no hardcoded git remote names (origin/upstream) in workflow, scripts, or documentation; uses gh CLI which doesn't require remote discovery.
Git Push Safety Rules ✅ Passed No git push or force push violations found. Workflow uses gh pr merge API, creates PRs on feature branch, no direct git pushes to main detected.
No Untrusted Mcp Servers ✅ Passed No MCP server installations from untrusted sources are introduced. PR only modifies automation workflows, Makefile targets, and documentation without adding any MCP server dependencies.
Ai-Helpers Overlap Detection ✅ Passed PR does not modify ai-helpers files matching the check patterns (plugins//commands/.md, plugins//skills//SKILL.md, agents/*.md). Phase 1 filtering criteria not met; check not applicable.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/update-docs.yml (1)

65-66: ⚡ Quick win

Avoid in-run expression interpolation for readability; “template-injection” risk is unclear

At lines 65-66, ${{ steps.create-pr.outputs.pull-request-number }} is evaluated by GitHub Actions before the shell runs, and peter-evans/create-pull-request returns pull-request-number as a (string) PR number; the step is already gated by if: steps.create-pr.outputs.pull-request-number. The main improvement here is optional hardening/readability: pass it via env and add a numeric guard before using it with gh pr diff/merge.

🔒 Suggested hardening
       - name: Enable auto-merge if only docs changed
         if: steps.create-pr.outputs.pull-request-number
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
         run: |
-          PR_NUMBER="${{ steps.create-pr.outputs.pull-request-number }}"
+          [[ "$PR_NUMBER" =~ ^[0-9]+$ ]] || { echo "Invalid PR number"; exit 1; }
           FILES_CHANGED=$(gh pr diff "$PR_NUMBER" --name-only)
           if [ "$FILES_CHANGED" = "docs/index.html" ]; then
             gh pr merge "$PR_NUMBER" --auto --squash
           fi
🤖 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-docs.yml around lines 65 - 66, The PR_NUMBER
interpolation should be moved out of the inline run string and passed via
environment (set PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
in the step env) and then guard its usage before calling gh pr diff: ensure
PR_NUMBER is non-empty and numeric (e.g., test -n "$PR_NUMBER" && [[
"$PR_NUMBER" =~ ^[0-9]+$ ]]) before running FILES_CHANGED=$(gh pr diff
"$PR_NUMBER" --name-only); update the step that sets FILES_CHANGED and any
subsequent gh pr merge/diff invocations to use the env PR_NUMBER variable with
this numeric guard to improve readability and hardening.
🤖 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 `@CONTRIBUTING.md`:
- Around line 50-53: The doc currently omits running the repository sync step
after version bumps; update the CONTRIBUTING.md steps to re-add "Run `make
update` after bumping the version in plugin.json" (placed between the version
bump step and `make lint`) and note that this syncs marketplace.json so
marketplace data stays current; reference plugin.json, make update, make lint,
and marketplace.json in the guidance so contributors run the update step after
changing plugin code.

---

Nitpick comments:
In @.github/workflows/update-docs.yml:
- Around line 65-66: The PR_NUMBER interpolation should be moved out of the
inline run string and passed via environment (set PR_NUMBER: ${{
steps.create-pr.outputs.pull-request-number }} in the step env) and then guard
its usage before calling gh pr diff: ensure PR_NUMBER is non-empty and numeric
(e.g., test -n "$PR_NUMBER" && [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]) before running
FILES_CHANGED=$(gh pr diff "$PR_NUMBER" --name-only); update the step that sets
FILES_CHANGED and any subsequent gh pr merge/diff invocations to use the env
PR_NUMBER variable with this numeric guard to improve readability and hardening.
🪄 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: CHILL

Plan: Enterprise

Run ID: 4ad9e20b-444d-45df-8d33-7fa51c36d0c8

📥 Commits

Reviewing files that changed from the base of the PR and between 8ec829d and 5d5b07f.

📒 Files selected for processing (6)
  • .github/workflows/update-docs.yml
  • .skillsaw.yaml
  • .skillsaw/plugindocs_rule.py
  • AGENTS.md
  • CONTRIBUTING.md
  • Makefile
💤 Files with no reviewable changes (2)
  • .skillsaw.yaml
  • .skillsaw/plugindocs_rule.py

Comment thread CONTRIBUTING.md
- Move PR_NUMBER to env var with numeric guard instead of inline
  expression interpolation
- Re-add make update step to contributor docs (still needed for
  marketplace version sync, just not for docs generation)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stbenjam

Copy link
Copy Markdown
Member Author

/hold

It might make sense to use the gh-pages branch so we don't have to build the image on those update PR's.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

@stbenjam

Copy link
Copy Markdown
Member Author

Defer this, the JSON structure is fine for now as a way to mitigate diff conflicts

@stbenjam stbenjam closed this May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant