Skip to content

Create release docs automation#8925

Open
amyblais wants to merge 7 commits intomasterfrom
amyblais-releasedocsautomation
Open

Create release docs automation#8925
amyblais wants to merge 7 commits intomasterfrom
amyblais-releasedocsautomation

Conversation

@amyblais
Copy link
Copy Markdown
Member

@amyblais amyblais commented Apr 30, 2026

Full spec doc: https://mattermost.atlassian.net/wiki/spaces/Security/pages/4518772760/Automation+-+Release+Docs+Update+GitHub+Actions+Workflow.

Adds a GitHub Actions workflow that automates docs updates for Mattermost releases. Instead of manually opening a GitHub issue, tagging claude, and pasting file URLs each time, you go to Actions → Update Docs → Run workflow and fill in four fields:

  • Component — Server, Mobile, or Desktop
  • Release type — ESR, Feature Release, Security Release, Patch/Dot Release, or Other
  • Version — e.g. 11.7, 2.40, 6.2
  • Release date — e.g. May 15, 2026
  • Additional instructions (optional) — any extra context like an ESR end-of-support date

The workflow then automatically selects the right set of files for that component and release type, sends each one to Claude via the Anthropic API with the release context, and opens a PR with all the updated files — no issue, no copy-pasting URLs, no manual file list.

Copilot AI review requested due to automatic review settings April 30, 2026 10:29
@amyblais amyblais added the Work In Progress Not yet ready for review label Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a manually triggered GitHub Actions workflow intended to automate release documentation updates by running a Python script and opening a PR in this docs repository.

Changes:

  • Introduces a new workflow_dispatch workflow with inputs (component, release type, version, release date, instructions, draft PR).
  • Sets up Python, installs the Anthropic SDK, runs a docs update script, and opens a PR via peter-evans/create-pull-request.

Comment thread .github/workflows/update-docs.yml
Comment thread .github/workflows/update-docs.yml Outdated
Comment thread .github/workflows/update-docs.yml Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA bf7c558

amyblais and others added 2 commits April 30, 2026 13:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 836a331

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@amyblais has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 56 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d4f74a34-6d37-4010-a3b0-3be70f5a387d

📥 Commits

Reviewing files that changed from the base of the PR and between 8b3f734 and 121da36.

📒 Files selected for processing (2)
  • .github/scripts/update_docs.py
  • .github/workflows/update-docs.yml
📝 Walkthrough

Walkthrough

This PR introduces automated documentation update tooling. A new GitHub Actions workflow accepts release metadata (component, version, release type, and optional instructions) and triggers a Python script that regenerates documentation files via the Anthropic API, then creates a pull request with the updates.

Changes

Automated Documentation Updates

Layer / File(s) Summary
Configuration & File Selection
\.github/scripts/update_docs\.py (lines 1–86)
Environment variables define component, release type, version, and release date; per-component/release-type file lists are hardcoded; get_files() selects the appropriate file list or exits on unknown component.
Prompt Construction & API Integration
\.github/scripts/update_docs\.py (lines 92–174)
System prompt instructs Claude to edit documentation with formatting constraints; build_user_prompt() embeds release metadata and file content; update_file() calls Anthropic Messages API with model claude-sonnet-4-6, applies safety checks (empty output, <50% length, unchanged content), and overwrites the file only if safe.
Script Orchestration
\.github/scripts/update_docs\.py (lines 180–217)
main() prints run metadata, instantiates Anthropic client from ANTHROPIC_API_KEY, iterates through selected files with per-file exception capture, and exits with status 1 if any file processing fails.
Workflow Trigger & PR Creation
\.github/workflows/update-docs\.yml
workflow_dispatch trigger with typed inputs (component, release_type, version, release_date, optional instructions and pr_draft); job checks out repo, installs Python 3.11 and anthropic package, runs the update script with env vars, and creates a PR to a docs branch with generated title/body and optional draft status.

Sequence Diagram

sequenceDiagram
    actor User
    participant GitHub as GitHub Actions
    participant Script as update_docs.py
    participant Anthropic as Anthropic API
    participant FileSystem as File System

    User->>GitHub: Trigger workflow_dispatch<br/>(component, version, release_type, etc.)
    GitHub->>GitHub: Checkout repo<br/>Setup Python 3.11<br/>Install anthropic package
    GitHub->>Script: Run with env vars<br/>(ANTHROPIC_API_KEY, metadata)
    Script->>FileSystem: Read file list<br/>for component & release_type
    loop For each documentation file
        Script->>FileSystem: Read file content
        Script->>Script: Build user prompt<br/>(metadata + content)
        Script->>Anthropic: Call Messages API<br/>(system + user prompt)
        Anthropic->>Anthropic: Generate updated docs
        Anthropic-->>Script: Return response.content[0].text
        Script->>Script: Validate safety checks<br/>(length, non-empty, changed)
        Script->>FileSystem: Write updated file<br/>(if safe)
    end
    Script-->>GitHub: Exit with status
    GitHub->>GitHub: Create PR<br/>docs/$component-v$version<br/>with generated title/body
    GitHub-->>User: PR created (draft or ready)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: a GitHub Actions workflow automation for release documentation updates.
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.
Description check ✅ Passed The pull request description clearly describes the automation workflow being added, linking to a spec and explaining the component, release type inputs, and the overall goal of automating documentation updates.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch amyblais-releasedocsautomation

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.

❤️ Share

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

@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 2eed2fe

@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA cb4dc94

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Newest code from mattermost has been published to preview environment for Git SHA 8b3f734

@amyblais amyblais added 1: Dev Review Requires review by a core commiter and removed Work In Progress Not yet ready for review labels May 5, 2026
@amyblais amyblais requested review from NARSimoes and esarafianou May 5, 2026 10:16
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

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

58-59: ⚡ Quick win

Pin the Anthropic SDK version for reproducible workflow runs.

Installing anthropic without a version can pull breaking changes and make the automation flaky over time. The latest stable version is 0.97.0 and is compatible with Python 3.11.

Suggested fix
-      - name: Install dependencies
-        run: pip install anthropic
+      - name: Install dependencies
+        run: pip install -r .github/scripts/update-docs-requirements.txt
# .github/scripts/update-docs-requirements.txt
anthropic==0.97.0
🤖 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 58 - 59, Replace the unpinned
pip install in the "Install dependencies" workflow step by pinning the Anthropic
SDK to 0.97.0: create a requirements file named
.github/scripts/update-docs-requirements.txt containing anthopic==0.97.0 and
change the step that currently runs "pip install anthropic" to "pip install -r
.github/scripts/update-docs-requirements.txt" so the workflow uses the fixed
anthropic==0.97.0 release for reproducible runs.
🤖 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/scripts/update_docs.py:
- Around line 138-140: The current handlers in update_docs.py (including the
except FileNotFoundError block and the other early-return sites around where
errors/warnings are logged) log problems then return, allowing main() to exit
success; change those returns to fail-fast behavior by raising or exiting
non‑zero (e.g., raise RuntimeError or call sys.exit(1)) so the workflow fails
when safety checks reject an update; update the except FileNotFoundError handler
and the two locations that log error/warning (the blocks referenced around lines
152–163) to propagate a non‑zero failure instead of returning normally.
- Line 142: The print statements using f-strings with no placeholders (e.g.,
print(f"  Sending to Claude...") and the similar print at line 183) should be
converted to plain strings; locate the print calls in update_docs.py (look for
the exact message "  Sending to Claude..." and the other analogous message) and
change them from f-strings to normal string literals (remove the leading f) so
they are simple print("  Sending to Claude...") calls.

In @.github/workflows/update-docs.yml:
- Line 75: Sanitize the free-form inputs.version before using it in the branch
ref: replace or remove characters that can make invalid Git branch names
(spaces, slashes, colons, parentheses, and other non-alphanumeric characters
except dot and dash), collapse consecutive separators to a single dash, trim
leading/trailing separators, and normalize case; then use that sanitized value
instead of inputs.version in the branch expression (replace branch: docs/${{
inputs.component }}-v${{ inputs.version }} with branch: docs/${{
inputs.component }}-v${{ steps.sanitize-version.outputs.version }} and add a
short step named sanitize-version that computes and outputs the cleaned version
string).

---

Nitpick comments:
In @.github/workflows/update-docs.yml:
- Around line 58-59: Replace the unpinned pip install in the "Install
dependencies" workflow step by pinning the Anthropic SDK to 0.97.0: create a
requirements file named .github/scripts/update-docs-requirements.txt containing
anthopic==0.97.0 and change the step that currently runs "pip install anthropic"
to "pip install -r .github/scripts/update-docs-requirements.txt" so the workflow
uses the fixed anthropic==0.97.0 release for reproducible runs.
🪄 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: dde1a4b0-2311-4c59-9766-35b752c87527

📥 Commits

Reviewing files that changed from the base of the PR and between 560c09f and 8b3f734.

📒 Files selected for processing (2)
  • .github/scripts/update_docs.py
  • .github/workflows/update-docs.yml

Comment thread .github/scripts/update_docs.py Outdated
Comment thread .github/scripts/update_docs.py Outdated
Comment thread .github/workflows/update-docs.yml Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Newest code from mattermost has been published to preview environment for Git SHA 36da96b

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Newest code from mattermost has been published to preview environment for Git SHA 121da36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1: Dev Review Requires review by a core commiter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants