feat: Enhance release workflow with AI changelog generation and docs sync trigger#227
feat: Enhance release workflow with AI changelog generation and docs sync trigger#227frontegg-david merged 5 commits intorelease/0.8.xfrom
Conversation
📝 WalkthroughWalkthroughPublish-release workflow now computes the prior tag, generates a size-capped filtered diff, requests an AI-generated CHANGELOG and Card MDX (if OpenAI key), writes /tmp/release-body.md, tags & creates a GitHub Release via body_path, and conditionally dispatches docs sync. The trigger-docs-update workflow no longer runs on PR merges. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Workflow as Publish-Release Workflow
participant Git as Git (repo & tags)
participant OpenAI as OpenAI API
participant GHAPI as GitHub API (Releases / Dispatch)
participant Docs as Docs Workflow
Workflow->>Git: fetch tags & determine previous tag
Workflow->>Git: generate filtered diff (prevTag..HEAD, <50KB)
alt prevTag found AND OPENAI_API_KEY present
Workflow->>OpenAI: send diff -> request CHANGELOG + CARD_MDX
OpenAI-->>Workflow: return CHANGELOG + CARD_MDX
Workflow->>Workflow: write /tmp/release-body.md (include AI content, hidden Card MDX)
else
Workflow->>Workflow: write /tmp/release-body.md without AI content
end
Workflow->>Git: create and push git tag
Workflow->>GHAPI: create GitHub Release using body_path (/tmp/release-body.md)
alt not prerelease AND DOCS_PAT present AND CARD_MDX exists
Workflow->>GHAPI: repository_dispatch -> trigger docs workflow
GHAPI->>Docs: start docs workflow
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/publish-release.yml:
- Around line 386-391: The current sed replacements for DIFF_PLACEHOLDER are
fragile because DIFF_CONTENT (stored in DIFF_ESCAPED) can contain sed-delimiter
characters like / and replacement-special & which break sed and corrupt
/tmp/prompt.json; replace the sed-based in-place substitutions with a safe JSON
construction using jq (or printf + jq) to populate VERSION, PREV_TAG and DIFF
fields from the variables (DIFF_CONTENT or DIFF_ESCAPED) so that special
characters are properly escaped, update the code paths that set DIFF_ESCAPED and
the three sed calls to instead build /tmp/prompt.json via jq writing the three
keys, and ensure the generated JSON is validated before use.
🧹 Nitpick comments (2)
.github/workflows/publish-release.yml (2)
393-412: Missing error handling for OpenAI API call.The curl request doesn't check for HTTP errors. API failures (rate limits, auth issues, server errors) will silently produce empty changelogs without any diagnostic info.
🛡️ Proposed fix to add error handling
# Call OpenAI API - RESPONSE=$(curl -s -X POST https://api.openai.com/v1/chat/completions \ + HTTP_CODE=$(curl -s -w "%{http_code}" -o /tmp/openai_response.json -X POST https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d `@/tmp/prompt.json`) + + RESPONSE=$(cat /tmp/openai_response.json) + + if [ "$HTTP_CODE" -ne 200 ]; then + echo "::warning::OpenAI API returned HTTP $HTTP_CODE" + echo "Response: $RESPONSE" + echo "has_changelog=false" >> "$GITHUB_OUTPUT" + exit 0 + fi # Extract content CONTENT=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // empty')
505-513: Add error handling for docs sync dispatch.If the repository dispatch fails (auth issues, wrong endpoint, etc.), it will fail silently. Consider checking the HTTP response code.
🛡️ Proposed fix to add error checking
# Trigger docs aggregator workflow - curl -X POST \ + HTTP_CODE=$(curl -s -w "%{http_code}" -o /dev/null -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $DOCS_REPO_PAT" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/agentfront/docs/dispatches \ - -d "{\"event_type\":\"frontmcp-release\",\"client_payload\":{\"version\":\"$VERSION\",\"repo\":\"frontmcp\"}}" + -d "{\"event_type\":\"frontmcp-release\",\"client_payload\":{\"version\":\"$VERSION\",\"repo\":\"frontmcp\"}}") + + if [ "$HTTP_CODE" -ne 204 ]; then + echo "::warning::Docs sync dispatch returned HTTP $HTTP_CODE (expected 204)" + fi echo "Triggered docs sync for v$VERSION"
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.github/workflows/publish-release.yml:
- Around line 339-341: The git diff invocation uses root-only globs ('*.ts'
'*.tsx' '*.js' '*.json') so nested files under libs/ and plugins/ are missed;
update the git diff command in the workflow (the line that starts with git diff
"$PREV_TAG"..HEAD) to use recursive globs ('**/*.ts' '**/*.tsx' '**/*.js'
'**/*.json') while keeping the existing negate patterns
(':!**/package-lock.json' etc.) so the diff captures all nested source files for
the changelog generation.
- Around line 311-326: The script currently finds PREV_TAG across all stable
tags; scope it to the current release line by deriving MAJOR.MINOR from
CURRENT_VERSION and using that to filter tags (e.g., match
'^vMAJOR\.MINOR\.[0-9]+$') when listing and sorting tags for PREV_TAG selection
(use the same fallback logic to look one more back on the scoped list, and if no
scoped tag exists then fall back to the global stable tag search). Update the
PREV_TAG selection logic that uses git tag -l, grep and sort so it builds and
applies the MAJOR.MINOR pattern from CURRENT_VERSION before choosing the
previous tag.
- Around line 498-517: The docs dispatch step should be skipped when Card MDX
wasn't generated; add a guard before the curl call that checks the same
condition used to skip Card MDX generation (e.g., the prepare job output or env
flag like needs.prepare.outputs.card_mdx_generated or an equivalent
SKIP_CARD_MDX/OPENAI_API_KEY check) and only run the HTTP dispatch when Card MDX
exists; update the "Trigger docs sync" step (the block containing VERSION="${{
needs.prepare.outputs.version }}" and the curl POST to
api.github.com/repos/agentfront/docs/dispatches) to bail out early (exit 0) when
that prepare output/flag indicates Card MDX was not produced.
Performance Test ResultsStatus: ✅ All tests passed Summary
Total: 100 tests across 21 projects 📊 View full report in workflow run Generated at: 2026-02-03T01:15:02.696Z |
…ion in publish-release.yml
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/publish-release.yml:
- Around line 438-451: The heredoc writing to /tmp/release-body.md (the cat >
/tmp/release-body.md << EOF ... EOF block) preserves the YAML indentation and
inserts unwanted leading spaces; replace that heredoc with explicit echo/printf
redirections that write each line without leading spaces (e.g., echo/printf
lines for "## Release v$VERSION", "**Release type:** $RELEASE_TYPE", "**Release
line:** $RELEASE_LINE.x", "**Branch:** $BRANCH", the "npm install
`@frontmcp/sdk`@$VERSION" code fence markers and blank lines) so the generated
file has no indentation and Markdown headers/code fences render correctly.
🧹 Nitpick comments (3)
.github/workflows/publish-release.yml (3)
399-402: Add a timeout to the OpenAI API call.The
curlcommand lacks a timeout, which could cause the workflow to hang indefinitely if the OpenAI API is slow or unresponsive. This is a reliability concern for CI pipelines.🔧 Proposed fix to add timeouts
# Call OpenAI API with HTTP status capture - HTTP_CODE=$(curl -s -w "%{http_code}" -o /tmp/openai_response.json -X POST https://api.openai.com/v1/chat/completions \ + HTTP_CODE=$(curl -s --connect-timeout 10 --max-time 60 -w "%{http_code}" -o /tmp/openai_response.json -X POST https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d `@/tmp/prompt.json`)
468-474: Consider escaping<!--in addition to-->.Line 472 escapes
-->to prevent breaking the HTML comment, but if the Card MDX content contains<!--, it would create a nested comment that prematurely closes the wrapper. This is unlikely but could cause subtle issues.🔧 Proposed fix to escape both comment markers
- sed 's/-->/--\>/g' /tmp/card-mdx.txt >> /tmp/release-body.md + sed -e 's/<!--/\<!--/g' -e 's/-->/--\>/g' /tmp/card-mdx.txt >> /tmp/release-body.md
526-531: Add a timeout to the docs sync API call.For consistency with the OpenAI call recommendation and to prevent workflow hangs, consider adding a timeout to this curl request as well.
🔧 Proposed fix
# Trigger docs aggregator workflow with HTTP status capture - HTTP_CODE=$(curl -s -w "%{http_code}" -o /dev/null -X POST \ + HTTP_CODE=$(curl -s --connect-timeout 10 --max-time 30 -w "%{http_code}" -o /dev/null -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $DOCS_REPO_PAT" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/agentfront/docs/dispatches \ -d "{\"event_type\":\"frontmcp-release\",\"client_payload\":{\"version\":\"$VERSION\",\"repo\":\"frontmcp\"}}")
…sionalism in publish-release.yml
…sionalism in publish-release.yml
Cherry-pick CreatedA cherry-pick PR to Please review and merge if this change should also be in If the cherry-pick is not needed, close the PR. |
Summary by CodeRabbit
New Features
Chores
Style
Documentation