Restored the `REPO_OVERRIDE_RE` regex export from core and aligned the dashboard's `githubTracking` component to consume it, fixing the export contract that was broken in FN-3921. Added tests in both core and dashboard packages to cover the regex behavior. Fusion-Task-Id: FN-3921
19 lines
712 B
TypeScript
19 lines
712 B
TypeScript
import { REPO_OVERRIDE_RE, type GlobalSettings, type ProjectSettings } from "@fusion/core";
|
|
|
|
export { REPO_OVERRIDE_RE };
|
|
|
|
function normalizeRepoValue(value: string | null | undefined): string {
|
|
const trimmed = value?.trim() ?? "";
|
|
return REPO_OVERRIDE_RE.test(trimmed) ? trimmed : "";
|
|
}
|
|
|
|
export function resolveEffectiveGithubRepoDefault(
|
|
projectSettings?: Pick<ProjectSettings, "githubTrackingDefaultRepo"> | null,
|
|
globalSettings?: Pick<GlobalSettings, "githubTrackingDefaultRepo"> | null,
|
|
): string {
|
|
const projectRepo = normalizeRepoValue(projectSettings?.githubTrackingDefaultRepo);
|
|
if (projectRepo) return projectRepo;
|
|
|
|
return normalizeRepoValue(globalSettings?.githubTrackingDefaultRepo);
|
|
}
|