|
90 | 90 |
|
91 | 91 | echo "has_changes=true" >> "$GITHUB_OUTPUT" |
92 | 92 |
|
93 | | - - name: Decide release bump with Claude Sonnet |
| 93 | + - name: Decide release bump with Claude Haiku 4.5 |
94 | 94 | id: decide |
95 | 95 | if: steps.prs.outputs.has_changes == 'true' |
96 | 96 | env: |
@@ -122,7 +122,7 @@ jobs: |
122 | 122 | PROMPT=$(echo "$PROMPT" | sed 's/^ //') |
123 | 123 |
|
124 | 124 | jq -n \ |
125 | | - --arg model "claude-3-5-sonnet-latest" \ |
| 125 | + --arg model "claude-haiku-4-5" \ |
126 | 126 | --arg system "You are precise and must output strict JSON only." \ |
127 | 127 | --arg prompt "$PROMPT" \ |
128 | 128 | --arg last_tag "$LAST_TAG" \ |
@@ -151,7 +151,45 @@ jobs: |
151 | 151 | fi |
152 | 152 |
|
153 | 153 | 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 |
155 | 193 |
|
156 | 194 | DECISION=$(jq -r '.decision' /tmp/decision.json) |
157 | 195 | REASON=$(jq -r '.reason' /tmp/decision.json) |
|
0 commit comments