export const RELEASE_COMMIT_PREVIEW_LIMIT = 6

export function formatCommitSubject(subject: string): string {
  return subject.replace(
    /^(feat|fix|chore|docs|refactor|style|test|build|ci)(\([^)]+\))?!?:\s*/i,
    "",
  )
}

export function getReleaseCommitPreview<T>(commits: T[], limit = RELEASE_COMMIT_PREVIEW_LIMIT): T[] {
  return commits.slice(0, limit)
}
