chore: Fix full auto release process (#7660)

This commit is contained in:
Louis Lam
2026-08-01 18:08:03 +08:00
committed by GitHub
parent 09dd7f3ff6
commit 315c9427a5
3 changed files with 25 additions and 11 deletions
+3
View File
@@ -76,6 +76,9 @@ jobs:
username: ${{ secrets.GHCR_USERNAME }} username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GHCR_TOKEN }}
- name: Install opencode
run: curl -fsSL https://opencode.ai/install | bash
- name: Run release-beta - name: Run release-beta
env: env:
RELEASE_BETA_VERSION: ${{ inputs.version }} RELEASE_BETA_VERSION: ${{ inputs.version }}
+3
View File
@@ -76,6 +76,9 @@ jobs:
username: ${{ secrets.GHCR_USERNAME }} username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GHCR_TOKEN }}
- name: Install opencode
run: curl -fsSL https://opencode.ai/install | bash
- name: Run release-final - name: Run release-final
env: env:
RELEASE_VERSION: ${{ inputs.version }} RELEASE_VERSION: ${{ inputs.version }}
+19 -11
View File
@@ -49,7 +49,7 @@ const llmPrompt = await getPrompt(previousVersion);
try { try {
const result = childProcess.spawnSync( const result = childProcess.spawnSync(
"opencode", "opencode",
["-p", llmPrompt, "-f", "text", "-q", "-m", "opencode/big-pickle"], ["run", "-m", "opencode/big-pickle", "--format", "json", llmPrompt],
{ {
encoding: "utf-8", encoding: "utf-8",
timeout: 120000, timeout: 120000,
@@ -59,18 +59,26 @@ try {
); );
if (result.status === 0 && result.stdout) { if (result.status === 0 && result.stdout) {
// Extract JSON from opencode's text output // Parse NDJSON output: find "type":"text" line
const jsonMatch = result.stdout.match(/\{[^{}]*"improvements"[^{}]*\}/s) || result.stdout.match(/\{[\s\S]*\}/); for (const line of result.stdout.trim().split("\n")) {
if (jsonMatch) {
try { try {
categorizedMap = JSON.parse(jsonMatch[0]); const obj = JSON.parse(line);
console.log("LLM categorization (opencode) applied."); if (obj.type === "text" && obj.part?.text) {
} catch (e) { const jsonMatch = obj.part.text.match(/\{[\s\S]*\}/);
console.warn("Failed to parse opencode JSON output:", e.message); if (jsonMatch) {
console.warn("Raw output:", result.stdout.slice(0, 500)); categorizedMap = JSON.parse(jsonMatch[0]);
console.log("LLM categorization applied.");
break;
}
}
} catch {
// skip unparseable lines
} }
} else { }
console.warn("Could not find JSON in opencode output.");
if (!categorizedMap) {
console.warn("No JSON found in opencode response.");
console.warn("Last 500 chars:", result.stdout.slice(-500));
} }
} else { } else {
console.warn("opencode failed or returned no output (status:", result.status, ")"); console.warn("opencode failed or returned no output (status:", result.status, ")");