Skip to content

Generate AI CHANGELOG entries for automated API update PRs - #591

Merged
dblock merged 1 commit into
slack-ruby:masterfrom
dblock:ai-generated-changelog-entries
Aug 12, 2026
Merged

Generate AI CHANGELOG entries for automated API update PRs#591
dblock merged 1 commit into
slack-ruby:masterfrom
dblock:ai-generated-changelog-entries

Conversation

@dblock

@dblock dblock commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Update API workflow (.github/workflows/update_api.yml) commits a single generic CHANGELOG.md line for every automated API update PR, e.g.:

* [#590](https://github.com/slack-ruby/slack-ruby-client/pull/590): Update API from [slack-api-ref@784d1d4](https://github.com/slack-ruby/slack-api-ref/commit/784d1d4) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot).

This says nothing about what actually changed.

Fix

Following the same approach as slack-ruby/slack-api-ref#87:

  • New .github/prompts/changelog-entries.prompt.yml: a structured prompt for actions/ai-inference@v1 (GitHub Models, default GITHUB_TOKEN with models: read, no extra secrets/subscription) that turns the diff produced by rake slack:api:update into a JSON array of short, grouped, imperative-mood entries (new/removed/renamed methods, argument/validation changes, error code changes, etc.), via responseFormat: json_schema for reliable parsing.
  • update_api.yml changes:
    • Adds models: read permission.
    • Checks whether the update produced any changes before calling the AI step.
    • Captures git diff --stat and a truncated git diff and runs actions/ai-inference@v1 with the new prompt file.
    • Builds a plain list of entries (for CHANGELOG) and a - prefixed list (for the PR body) from the parsed JSON response.
    • Includes the entries under a ## Changes heading in the PR body.
    • Replaces the jacobtomlinson/gha-find-replace@v3 CHANGELOG step with a small inline Python script that writes one CHANGELOG bullet per entry, each referencing the same automated PR number, e.g.:
      * [#591](.../pull/591): Add chat.appendStream and chat.stopStream methods - [@slack-ruby-ci-bot](...).
      * [#591](.../pull/591): Add a metadata argument to chat.postEphemeral, chat.postMessage, chat.scheduleMessage, and chat.update - [@slack-ruby-ci-bot](...).
      
    • Falls back to the original generic, rev-based single-line message if there are no changes, the AI step fails, or the response is empty/malformed, so the workflow never blocks on this step.

Verified the workflow and prompt YAML parse correctly, the embedded JSON schema is valid, and manually simulated the CHANGELOG-rewriting Python script and the - bullet-list formatting with sample entries to confirm output.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@dblock
dblock force-pushed the ai-generated-changelog-entries branch 3 times, most recently from 0027b11 to aa251fe Compare August 12, 2026 00:55
The Update API workflow committed a single generic CHANGELOG.md line
for every automated update PR: "Update API from
slack-api-ref@<rev>", with no indication of what actually changed.

Following the same approach as slack-ruby/slack-api-ref#87, add a
GitHub Models-backed step (actions/ai-inference@v1, default
GITHUB_TOKEN with models: read permission, no extra secrets needed)
that summarizes the diff produced by rake slack:api:update into a
short list of grouped, descriptive entries (new/removed methods,
argument/validation changes, error code changes, etc.) via a
structured .github/prompts/changelog-entries.prompt.yml with a JSON
schema response.

Each generated entry becomes its own CHANGELOG.md bullet, all tagged
with the same automated PR number, replacing the old single generic
line. The same list is also included under a "## Changes" heading in
the PR body for reviewers. Falls back to the original generic,
rev-based message if there are no changes, the AI step fails, or the
response is empty/malformed, so the workflow never blocks on this
step. Uses Ruby (already set up in this workflow) instead of Python
for the inline CHANGELOG-rewriting script, for consistency with the
rest of this Ruby project.

Also locks simplecov below 1.1.0 in the Gemfile: 1.1.0 changed
Result#to_hash to write a float timestamp to
coverage/.resultset.json, which coverallsapp/github-action's parser
(typed Int64?) fails to deserialize, breaking the Coveralls step in
CI (coverallsapp/github-action#269, fix tracked upstream in
coverallsapp/coverage-reporter#191).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock
dblock force-pushed the ai-generated-changelog-entries branch from aa251fe to 56084ef Compare August 12, 2026 01:10
@dblock
dblock merged commit 5fce593 into slack-ruby:master Aug 12, 2026
10 checks passed
@dblock
dblock deleted the ai-generated-changelog-entries branch August 12, 2026 01:12
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 31552746342

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage decreased (-0.02%) to 91.055%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 5746
Covered Lines: 5232
Line Coverage: 91.05%
Coverage Strength: 100.24 hits per line

💛 - Coveralls

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants