Skip to content

Commit b9c2822

Browse files
authored
Merge pull request #598 from slack-ruby/dblock/fix-update-api-copilot-narration
Extract JSON from Copilot CLI response despite narration, fail visibly when missing
2 parents efb6221 + 0baddb1 commit b9c2822

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎.github/workflows/update_api.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@ jobs:
7171
response_file="${{ steps.ai.outputs.response-file }}"
7272
echo "AI changelog response:"
7373
cat "$response_file" || true
74-
filtered="$(grep -v '^```' "$response_file" 2>/dev/null)"
75-
entries="$(printf '%s' "$filtered" | jq -r '.entries[]? // empty' 2>/dev/null || true)"
74+
# Copilot CLI's response file may include narration/thinking lines
75+
# before the final JSON answer, so grab the last line that looks
76+
# like a JSON object rather than trying to parse the whole file.
77+
json_line="$(grep -E '^\{.*\}$' "$response_file" 2>/dev/null | tail -n 1)"
78+
if [ -z "$json_line" ]; then
79+
echo "::error::AI changelog response did not contain a JSON object, see response above."
80+
exit 1
81+
fi
82+
entries="$(printf '%s' "$json_line" | jq -r '.entries[]? // empty')"
7683
fi
7784
if [ -z "$entries" ]; then
7885
entries="Update API from slack-api-ref@${{ steps.api-ref.outputs.api-ref }}"

‎CHANGELOG.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
### 3.2.1 (Next)
22

33
* [#591](https://github.com/slack-ruby/slack-ruby-client/pull/591): Generate AI CHANGELOG entries and PR summaries for automated API update PRs, lock simplecov below 1.1.0 to avoid breaking Coveralls - [@dblock](https://github.com/dblock).
4-
* [#592](https://github.com/slack-ruby/slack-ruby-client/pull/592): Fix a YAML indentation bug in AI CHANGELOG entry generation that broke the automated API update workflow - [@dblock](https://github.com/dblock).
5-
* [#593](https://github.com/slack-ruby/slack-ruby-client/pull/593): Migrate AI CHANGELOG entry generation to Copilot CLI after GitHub Models retirement - [@dblock](https://github.com/dblock).
6-
* [#596](https://github.com/slack-ruby/slack-ruby-client/pull/596): Fix the `update_api` workflow failing with exit code 5 when the AI-generated changelog response isn't valid JSON, and always log the raw AI response for debugging - [@dblock](https://github.com/dblock).
74
* [#590](https://github.com/slack-ruby/slack-ruby-client/pull/590): Add entity.acknowledgeCommentAction and entity.presentComments methods - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot).
85
* [#590](https://github.com/slack-ruby/slack-ruby-client/pull/590): Add admin.apps.mcpServers, admin.apps.mcpServers.permissions, and admin.apps.permissions endpoints - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot).
96
* [#590](https://github.com/slack-ruby/slack-ruby-client/pull/590): Add a metadata argument to chat.postEphemeral - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot).

0 commit comments

Comments
 (0)