/
githubmirror
/
grafana
Обзор
Документация
Войти
/
githubmirror
/
grafana
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
scripts/cli/analytics/codeowners.mts
21 строка
793 B
Matt Cowley
Chore: Expand ESLint + lefthook coverage to all JS-alike files (#130259)
10 авг 2026, 14:07
Не верифицирован
10 авг 2026, 14:07
b2f3648
Код
Авторство
О чём код?
import { OwnershipEngine } from 'github-codeowners/dist/lib/ownership/index.js'; import path from 'path'; const CODEOWNERS_PATH = path.resolve('.github/CODEOWNERS'); let engine: { calcFileOwnership(filePath: string): string[] } | null = null; const getEngine = (): { calcFileOwnership(filePath: string): string[] } => { engine ??= OwnershipEngine.FromCodeownersFile(CODEOWNERS_PATH); return engine; }; /** * Returns the owners for the given file path. * Uses the same OwnershipEngine as the CI/CD codeowners tooling. * Returns undefined when no rule matches. */ export const resolveOwner = (relativeFilePath: string): string | undefined => { const owners: string[] = getEngine().calcFileOwnership(relativeFilePath); return owners.length > 0 ? owners.join(', ') : undefined; };