1
0

Update repository description and fetch updated clone URL in main.js

This commit is contained in:
2025-06-01 12:28:48 +02:00
parent 26a6463c25
commit a539bedbbd

16
main.js
View File

@@ -2310,8 +2310,20 @@ ipcMain.handle('push-to-gitea', async (_evt, folderPath) => {
const created = await createResp.json(); const created = await createResp.json();
repoUrl = created.clone_url; repoUrl = created.clone_url;
} else if (checkResp.ok) { } else if (checkResp.ok) {
// 4b) Repo already exists → use its clone_url // Repo already exists → first update its description
const existing = await checkResp.json(); await fetch(`${GITEA_BASE}/repos/${username}/${repoName}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: `token ${GITEA_TOKEN}`
},
body: JSON.stringify({ description })
});
// Now fetch the repo data so we get the uptodate clone_url
const existing = await (await fetch(`${GITEA_BASE}/repos/${username}/${repoName}`, {
headers: { Authorization: `token ${GITEA_TOKEN}` }
})).json();
repoUrl = existing.clone_url; repoUrl = existing.clone_url;
} else { } else {
const txt = await checkResp.text(); const txt = await checkResp.text();