Files
tickte-system/src/lib/projectAssign.js
T
2026-09-30 10:41:35 +00:00

46 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export const GITEA_ORG = 'WEBklar'
export function isOutsideOrg(repoFullName) {
if (!repoFullName) return false
const org = repoFullName.split('/')[0] || ''
return org.toLowerCase() !== GITEA_ORG.toLowerCase()
}
export function needsPreviewButton(project) {
return !project.previewUrl || project.status !== 'deployed'
}
export function assignSummary(projectName, result) {
if (result && result.error) {
return { text: `${projectName}: Zuweisen fehlgeschlagen – ${result.error}`, warnings: [] }
}
const { moved, backfilled, warnings = [] } = result
const parts = []
if (moved) {
parts.push('nach WEBklar verschoben')
}
if (backfilled === 1) {
parts.push('1 Push nachgetragen')
} else if (backfilled > 1) {
parts.push(`${backfilled} Pushes nachgetragen`)
} else {
parts.push('keine neuen Pushes')
}
return { text: `${projectName}: ${parts.join(' · ')}`, warnings }
}
export async function assignSequentially(projectIds, ctx, assignFn) {
const results = []
for (const projectId of projectIds) {
try {
const result = await assignFn(projectId, ctx)
results.push({ projectId, ok: true, result })
} catch (err) {
results.push({ projectId, ok: false, error: err.message })
}
}
return results
}