Skip to content

Commit 39a9c35

Browse files
committed
fix: commetta ZIP su main (dove c'è il workflow) per evitare errore 422 su ci-build
1 parent 771ffe8 commit 39a9c35

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎src/app/api/github-build/route.ts‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
octo,
44
serverConfig,
55
workflowExists,
6-
ensureBranchFrom,
76
commitFile,
87
dispatchWorkflow,
98
recentRunStats,
@@ -101,26 +100,24 @@ export async function POST(req: NextRequest) {
101100
}
102101

103102
if (file) {
104-
// --- Modalità ZIP: committa lo zip su un branch di build e compila da lì ---
103+
// --- Modalità ZIP: commetto lo zip sul branch attuale e compilo da lì ---
105104
if (file.size > 45 * 1024 * 1024) {
106105
return NextResponse.json({ error: msg(lang, 'tooBig') }, { status: 413 });
107106
}
108107
const bytes = Buffer.from(await file.arrayBuffer());
109108
const base64 = bytes.toString('base64');
110-
const buildBranch = 'ci-build';
111109
const zipPath = 'builds/site.zip';
112110

113-
await ensureBranchFrom(octokit, owner, repoName, buildBranch, branch);
114111
await commitFile(
115112
octokit,
116113
owner,
117114
repoName,
118-
buildBranch,
115+
branch,
119116
zipPath,
120117
base64,
121118
`WebToApp: upload site ${appId || ''}`.trim()
122119
);
123-
await dispatchWorkflow(octokit, owner, repoName, WORKFLOW_ID, buildBranch, {
120+
await dispatchWorkflow(octokit, owner, repoName, WORKFLOW_ID, branch, {
124121
app_name: appName,
125122
app_id: appId,
126123
web_url: url,
@@ -131,7 +128,7 @@ export async function POST(req: NextRequest) {
131128
return NextResponse.json({
132129
success: true,
133130
mode: 'zip',
134-
branch: buildBranch,
131+
branch,
135132
repo: `${owner}/${repoName}`,
136133
message: 'Build avviata dal tuo ZIP.',
137134
});

0 commit comments

Comments
 (0)