Update repository description and fetch updated clone URL in main.js
This commit is contained in:
16
main.js
16
main.js
@@ -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 up‐to‐date 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();
|
||||||
|
|||||||
Reference in New Issue
Block a user