Skip to content

Commit 2f7de4e

Browse files
committed
release: switch AI bump-decider to Claude Haiku 4.5
1 parent 3da88c5 commit 2f7de4e

1 file changed

Lines changed: 41 additions & 3 deletions

File tree

.github/workflows/release-on-main.yml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
9191
echo "has_changes=true" >> "$GITHUB_OUTPUT"
9292
93-
- name: Decide release bump with Claude Sonnet
93+
- name: Decide release bump with Claude Haiku 4.5
9494
id: decide
9595
if: steps.prs.outputs.has_changes == 'true'
9696
env:
@@ -122,7 +122,7 @@ jobs:
122122
PROMPT=$(echo "$PROMPT" | sed 's/^ //')
123123
124124
jq -n \
125-
--arg model "claude-3-5-sonnet-latest" \
125+
--arg model "claude-haiku-4-5" \
126126
--arg system "You are precise and must output strict JSON only." \
127127
--arg prompt "$PROMPT" \
128128
--arg last_tag "$LAST_TAG" \
@@ -151,7 +151,45 @@ jobs:
151151
fi
152152
153153
echo "$TEXT" > /tmp/decision-raw.txt
154-
jq . /tmp/decision-raw.txt > /tmp/decision.json
154+
python3 - <<'PY'
155+
import json
156+
import re
157+
import sys
158+
159+
text = open('/tmp/decision-raw.txt', encoding='utf-8').read().strip()
160+
161+
def parse_json(candidate: str):
162+
try:
163+
return json.loads(candidate)
164+
except Exception:
165+
return None
166+
167+
decision = parse_json(text)
168+
if decision is None:
169+
fenced = re.search(r"```(?:json)?\s*([\s\S]*?)\s*```", text, re.IGNORECASE)
170+
if fenced:
171+
decision = parse_json(fenced.group(1).strip())
172+
173+
if decision is None:
174+
decoder = json.JSONDecoder()
175+
for index, ch in enumerate(text):
176+
if ch != '{':
177+
continue
178+
try:
179+
decision, _ = decoder.raw_decode(text[index:])
180+
break
181+
except Exception:
182+
continue
183+
184+
if decision is None:
185+
print("Failed to parse release decision JSON from model response", file=sys.stderr)
186+
print(text, file=sys.stderr)
187+
sys.exit(1)
188+
189+
with open('/tmp/decision.json', 'w', encoding='utf-8') as fh:
190+
json.dump(decision, fh)
191+
fh.write('\n')
192+
PY
155193
156194
DECISION=$(jq -r '.decision' /tmp/decision.json)
157195
REASON=$(jq -r '.reason' /tmp/decision.json)

0 commit comments

Comments
 (0)