Skip to content

Create workflow for automated changelogs#8824

Open
amyblais wants to merge 13 commits intomasterfrom
amyblais-changelogautomation
Open

Create workflow for automated changelogs#8824
amyblais wants to merge 13 commits intomasterfrom
amyblais-changelogautomation

Conversation

@amyblais
Copy link
Member

@amyblais amyblais commented Mar 18, 2026

Created with the help of Claude Cowork 🤖

Add a new workflow that:

  • Automatically pulls release notes from merged server and enterprise PRs.
  • Automatically transforms raw, unstructured release notes into a clean, categorized, and grammatically correct changelog entry.
  • Automatically opens a changelog PR for review.

Summary by CodeRabbit

Release Notes

  • Chores
    • Implemented automated changelog generation workflow to streamline compilation of release notes from merged pull requests, with optional AI-assisted formatting for consistency.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow and Python script are added to automate changelog generation from merged pull requests. The workflow triggers via manual dispatch, retrieves merged PRs for specified repositories and milestones, extracts release notes and Jira links, optionally polishes content with Claude AI, and opens a PR with the generated changelog.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/generate-changelog.yml
Defines a new GitHub Actions workflow triggered by manual dispatch, acquiring an app installation token, checking out the docs repository, setting up Python 3.11 with dependencies, running the changelog generation script, and creating a pull request with the generated changelog.
Changelog Generation Script
.github/scripts/generate_changelog.py
Implements changelog automation logic including milestone lookup, retrieval of merged PRs from GitHub API, extraction of release notes and Jira references, optional AI-assisted polishing via Claude, and file operations to prepend formatted changelog entries to a markdown file.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant GitHub as GitHub API
    participant Script as generate_changelog.py
    participant Claude as Claude API
    participant Docs as Docs Repo

    User->>Script: Trigger workflow<br/>(milestone, version, repos)
    Script->>GitHub: Look up milestone number<br/>per repository
    GitHub-->>Script: Milestone ID(s)
    Script->>GitHub: Fetch merged PRs<br/>for milestone
    GitHub-->>Script: PR data & metadata
    Script->>Script: Extract release notes<br/>from PR bodies
    Script->>Script: Extract Jira links<br/>from PR references
    alt Has ANTHROPIC_API_KEY
        Script->>Claude: Polish release notes<br/>with AI
        Claude-->>Script: Refined notes
    else No API Key
        Script->>Script: Format notes<br/>as bullets
    end
    Script->>Script: Format changelog entry<br/>(version, date, sections)
    Script->>Docs: Prepend entry to<br/>CHANGELOG.md
    Docs-->>Script: File updated
    Script->>GitHub: Create PR on<br/>docs repo
    GitHub-->>User: PR created
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: a new GitHub Actions workflow for automating changelog generation from merged PRs.
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch amyblais-changelogautomation
📝 Coding Plan
  • Generate coding plan for human review comments

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
Contributor

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

@github-actions
Copy link
Contributor

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

@amyblais amyblais changed the title Create generate-changelog.yml Create workflow for automated changelogs Mar 18, 2026
@amyblais amyblais added the 1: Dev Review Requires review by a core commiter label Mar 18, 2026
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

Copy link

@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: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/generate-changelog.yml:
- Around line 52-59: The workflow job "Generate changelog" is running the wrong
script path; update the run command to call the new location of the script
(scripts/generate_changelog.py) so the runner executes the file added in this
PR; locate the job named "Generate changelog" and change the run entry from
"python .github/scripts/generate_changelog.py" to run "python
scripts/generate_changelog.py" (or alternatively move the script into
.github/scripts if you prefer to keep the original path).
- Around line 72-76: The GH CLI invocation in the gh pr create step hard-codes
the target branch via the --base main flag; change that to use the repository's
actual default branch by replacing the literal --base main with --base ${{
github.event.repository.default_branch }} so the PR opens against the repo's
default branch at runtime (update the gh pr create command invocation).

In `@scripts/generate_changelog.py`:
- Around line 34-47: The category headings in the generated changelog are being
emitted at the same level as the release header (because the prompt asks for
`##` headings) so change the prompt/template in scripts/generate_changelog.py
where `entry` is built (it currently starts with `## {VERSION} - {today}`) so
that all subsequent category headings use `###` instead of `##` and also ensure
the prompt instructs the generator to omit any empty categories; update the
string/variable that defines the list of categories to request `### User
Interface`, `### Administration`, etc., and confirm the code that appends
categories only includes non-empty ones.
- Around line 56-68: The milestone lookup in the function that queries url =
f"https://api.github.com/repos/{repo}/milestones" only checks the first page and
must be paginated like get_merged_prs(); update the logic to follow pagination
(use resp.links.get("next") or loop incrementing params["page"]) and iterate
through every page's resp.json() checking m["title"] == title, returning
m["number"] as soon as a match is found; only after exhausting all pages should
you print the "Milestone ... not found" message and return None, reusing
HEADERS, params and the existing resp.raise_for_status() pattern.
- Around line 161-168: Wrap the API call to client.messages.create(...) in a
try-except that catches any Exception; on success continue to return
response.content[0].text.strip() as before, but on failure log the exception (or
use processLogger) and return the already-available plain bullet list of raw
notes instead (e.g., join the raw notes into "- item" lines or call the existing
fallback formatter used for missing API key/package). Apply this change around
the client.messages.create(...) call and reference the variables client,
user_message, SYSTEM_PROMPT and response when editing.
- Around line 58-59: The requests.get() calls in generate_changelog.py (the one
that assigns resp and the second at the later call) lack explicit timeouts,
which can hang CI; update both requests.get(...) invocations to include a
timeout parameter (e.g., timeout=30) so the call fails fast on unresponsive
GitHub endpoints—locate the occurrences around the resp = requests.get(url,
headers=HEADERS, params=params) assignment and the second requests.get usage and
add timeout=30 to their argument lists.
- Around line 88-91: The PR filter inside the loop over items incorrectly checks
item["pull_request"].get("merged_at") so merged PRs are never detected; update
the check to use the top-level merged_at field by replacing
item["pull_request"].get("merged_at") with item.get("merged_at") in the loop
that builds prs (variables: items, item, prs) so merged pull requests are
correctly appended.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a02297b8-d09d-40c4-87de-647be57ab533

📥 Commits

Reviewing files that changed from the base of the PR and between ff0d680 and c561a08.

📒 Files selected for processing (2)
  • .github/workflows/generate-changelog.yml
  • scripts/generate_changelog.py

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@amyblais amyblais added Work In Progress Not yet ready for review and removed 1: Dev Review Requires review by a core commiter labels Mar 18, 2026
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@amyblais
Copy link
Member Author

@coderabbitai help

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
    • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
    • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
    • @coderabbitai plan to generate a coding prompt for all unresolved human review comments in this PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai fix merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • 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

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@amyblais
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

✅ Actions performed

Full review triggered.

@github-actions
Copy link
Contributor

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

Copy link

@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: 4

🧹 Nitpick comments (1)
.github/workflows/generate-changelog.yml (1)

49-50: Pin workflow Python dependencies for reproducible runs.

Installing unpinned requests and anthropic can introduce non-deterministic failures when upstream releases change behaviour.

🔧 Proposed fix
-      - name: Install dependencies
-        run: pip install requests anthropic
+      - name: Install dependencies
+        run: pip install -r .github/scripts/requirements-generate-changelog.txt

You can keep exact pins in .github/scripts/requirements-generate-changelog.txt and update them deliberately.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/generate-changelog.yml around lines 49 - 50, The workflow
step "Install dependencies" currently runs an unpinned pip install of requests
and anthropic; change it to install pinned dependencies from the requirements
file instead (e.g. replace the run command with pip install -r
.github/scripts/requirements-generate-changelog.txt) and add that requirements
file with exact version pins for requests and anthropic (and any other Python
deps used by the changelog generator) so CI runs are reproducible; update the
workflow step name "Install dependencies" if needed to reflect the pinned
install.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/scripts/generate_changelog.py:
- Line 85: The requests.get calls (e.g., the assignment to resp using
requests.get(url, headers=HEADERS, params=params)) lack timeouts and can block;
update both occurrences (the top-level requests.get and the one inside the
pagination loop) to pass a timeout argument (e.g., timeout=10 or a defined
constant like REQUEST_TIMEOUT_SECS) and propagate that constant to both calls so
they share the same value; ensure you import or define the timeout constant near
module-level configuration and add the timeout kwarg to requests.get(...)
invocations that use HEADERS/params and the paginated requests.
- Around line 222-229: Wrap the Anthropic API call (client.messages.create(...))
and the subsequent return of response.content[0].text.strip() in a try/except
block: catch broad exceptions from network/API/unexpected response shapes, log
or print the exception, and on any failure return the existing formatted
fallback (formatted raw_notes) used elsewhere in this script; use the same
variables referenced (client, SYSTEM_PROMPT, user_message, response) and ensure
the fallback path returns a string consistent with previous fallbacks so
transient API errors do not abort changelog generation.
- Around line 115-118: The loop that builds prs is checking merged_at at the top
level (item.get("merged_at")) which is always absent; update the filter to read
the nested field item["pull_request"]["merged_at"] (or use
item.get("pull_request", {}).get("merged_at")) so the condition correctly
detects merged PRs when iterating items and appends them to prs in
generate_changelog.py.
- Around line 84-95: get_milestone_number currently fetches only the first 100
milestones and can miss matches; change it to use pagination like get_merged_prs
by introducing a page loop (e.g., page = 1; while True) and include "page" in
params (params = {"state":"all","per_page":100,"page": page}), call
requests.get/resp.raise_for_status for each page, inspect resp.json() and return
m["number"] as soon as a matching m["title"] == title is found, break/return
when the returned list is empty (no more pages), and only then print the
not-found message and return None; keep using the existing HEADERS and variable
names.

---

Nitpick comments:
In @.github/workflows/generate-changelog.yml:
- Around line 49-50: The workflow step "Install dependencies" currently runs an
unpinned pip install of requests and anthropic; change it to install pinned
dependencies from the requirements file instead (e.g. replace the run command
with pip install -r .github/scripts/requirements-generate-changelog.txt) and add
that requirements file with exact version pins for requests and anthropic (and
any other Python deps used by the changelog generator) so CI runs are
reproducible; update the workflow step name "Install dependencies" if needed to
reflect the pinned install.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aa5e819f-edb3-4bdf-9cb4-7f90453d798b

📥 Commits

Reviewing files that changed from the base of the PR and between c561a08 and a18a89e.

📒 Files selected for processing (2)
  • .github/scripts/generate_changelog.py
  • .github/workflows/generate-changelog.yml

amyblais and others added 2 commits March 18, 2026 14:56
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@amyblais amyblais added 1: Dev Review Requires review by a core commiter and removed Work In Progress Not yet ready for review labels Mar 18, 2026
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.

1 participant