Skip to content

Commit bcc4014

Browse files
committed
Adapt release draft to Claude base action inputs
1 parent f51e980 commit bcc4014

1 file changed

Lines changed: 50 additions & 26 deletions

File tree

.github/workflows/release-draft.yml

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ jobs:
3838
uses: anthropics/claude-code-base-action@e8132bc5e637a42c27763fc757faa37e1ee43b34
3939
with:
4040
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
41-
show_full_output: true
41+
model: claude-opus-4-6
42+
max_turns: "50"
43+
timeout_minutes: "10"
4244
prompt: |
4345
Analyze PR #${{ github.event.pull_request.number }} for breaking changes.
4446
@@ -76,36 +78,58 @@ jobs:
7678
- If code examples help, include them in markdown code blocks
7779
- Only include categories that have actual breaking changes
7880
- Return empty string for breaking_changes_content if no breaking changes
79-
80-
claude_args: |
81-
--model claude-opus-4-6
82-
--max-turns 50
83-
--json-schema '{"type":"object","properties":{"has_breaking_changes":{"type":"boolean","description":"Whether this PR contains breaking changes"},"breaking_changes_content":{"type":"string","description":"Formatted breaking changes section content (without ## Breaking Changes header), or empty string if none"},"reasoning":{"type":"string","description":"Brief explanation of why this is or is not a breaking change"}},"required":["has_breaking_changes","breaking_changes_content","reasoning"]}'
81+
Return ONLY a valid JSON object with this exact schema:
82+
{"has_breaking_changes": boolean, "breaking_changes_content": string, "reasoning": string}
83+
Do not wrap the JSON in markdown code fences.
8484
8585
- name: Parse Claude output
8686
id: parse
8787
env:
88-
CLAUDE_OUTPUT: ${{ steps.claude.outputs.structured_output }}
88+
CLAUDE_EXECUTION_FILE: ${{ steps.claude.outputs.execution_file }}
8989
run: |
90-
HAS_BC=$(echo "$CLAUDE_OUTPUT" | jq -r '.has_breaking_changes // false')
91-
BC_CONTENT=$(echo "$CLAUDE_OUTPUT" | jq -r '.breaking_changes_content // ""')
92-
REASONING=$(echo "$CLAUDE_OUTPUT" | jq -r '.reasoning // ""')
93-
94-
echo "has_breaking_changes=$HAS_BC" >> $GITHUB_OUTPUT
95-
96-
DELIMITER="EOF_$(date +%s%N)"
97-
98-
{
99-
echo "breaking_changes_content<<$DELIMITER"
100-
printf '%s\n' "$BC_CONTENT"
101-
echo "$DELIMITER"
102-
} >> $GITHUB_OUTPUT
103-
104-
{
105-
echo "reasoning<<$DELIMITER"
106-
printf '%s\n' "$REASONING"
107-
echo "$DELIMITER"
108-
} >> $GITHUB_OUTPUT
90+
python3 - <<'PY'
91+
import json
92+
import os
93+
import re
94+
from pathlib import Path
95+
96+
execution_file = Path(os.environ["CLAUDE_EXECUTION_FILE"])
97+
execution_log = json.loads(execution_file.read_text())
98+
99+
assistant_content = ""
100+
for item in reversed(execution_log):
101+
if item.get("role") != "assistant":
102+
continue
103+
content = item.get("content", "")
104+
if isinstance(content, str):
105+
assistant_content = content
106+
break
107+
if isinstance(content, list):
108+
text_parts = []
109+
for block in content:
110+
if isinstance(block, dict) and block.get("type") == "text":
111+
text_parts.append(block.get("text", ""))
112+
assistant_content = "\n".join(text_parts).strip()
113+
if assistant_content:
114+
break
115+
116+
if not assistant_content:
117+
raise SystemExit("No assistant response found in Claude execution log")
118+
119+
assistant_content = assistant_content.strip()
120+
fenced = re.fullmatch(r"```(?:json)?\s*(.*?)\s*```", assistant_content, re.DOTALL)
121+
if fenced:
122+
assistant_content = fenced.group(1).strip()
123+
124+
data = json.loads(assistant_content)
125+
126+
github_output = Path(os.environ["GITHUB_OUTPUT"])
127+
delimiter = "EOF_PARSE_OUTPUT"
128+
with github_output.open("a", encoding="utf-8") as f:
129+
f.write(f"has_breaking_changes={str(data.get('has_breaking_changes', False)).lower()}\n")
130+
f.write(f"breaking_changes_content<<{delimiter}\n{data.get('breaking_changes_content', '')}\n{delimiter}\n")
131+
f.write(f"reasoning<<{delimiter}\n{data.get('reasoning', '')}\n{delimiter}\n")
132+
PY
109133
110134
- name: Add breaking-change-analyzed label
111135
env:

0 commit comments

Comments
 (0)