fix: verwaiste Projekte archivierbar (Gitea-Repo 404 nicht mehr hart abbrechen)
- archiveRepo: fehlt das Gitea-Repo (404), wird nur das Appwrite-Dokument (ent)archiviert statt hart zu scheitern -> orphaned Projekte lassen sich aus der Liste entfernen - Reaktivierungs-Redeploy wird bei fehlendem Repo uebersprungen Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -482,13 +482,21 @@ export async function archiveRepo(projectId, archived = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const repoFullName = doc.repoFullName || ''
|
const repoFullName = doc.repoFullName || ''
|
||||||
|
let repoMissing = false
|
||||||
if (repoFullName.includes('/')) {
|
if (repoFullName.includes('/')) {
|
||||||
try {
|
try {
|
||||||
await patchGiteaRepo(repoFullName, { archived: Boolean(archived) })
|
await patchGiteaRepo(repoFullName, { archived: Boolean(archived) })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = new Error('Gitea-Archivierung fehlgeschlagen: ' + err.message)
|
// Verwaistes Projekt: Repo existiert nicht mehr in Gitea (404). Dann trotzdem
|
||||||
error.status = err.status || 500
|
// nur das Appwrite-Dokument (ent)archivieren, damit es aus der Liste verschwindet.
|
||||||
throw error
|
if (err.status === 404) {
|
||||||
|
repoMissing = true
|
||||||
|
console.warn(`[archiveRepo] Gitea-Repo ${repoFullName} nicht gefunden (404) - nur Appwrite wird aktualisiert`)
|
||||||
|
} else {
|
||||||
|
const error = new Error('Gitea-Archivierung fehlgeschlagen: ' + err.message)
|
||||||
|
error.status = err.status || 500
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,7 +506,7 @@ export async function archiveRepo(projectId, archived = true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!archived && doc.subdomain) {
|
if (!archived && !repoMissing && doc.subdomain) {
|
||||||
try {
|
try {
|
||||||
const branch = (await getRepoInfo(repoFullName))?.defaultBranch || 'main'
|
const branch = (await getRepoInfo(repoFullName))?.defaultBranch || 'main'
|
||||||
const cfg = (await fetchPreviewConfig(repoFullName, branch)) || {
|
const cfg = (await fetchPreviewConfig(repoFullName, branch)) || {
|
||||||
|
|||||||
Reference in New Issue
Block a user