From 871c77eed4c23b7de62bbb9d6412cf0791923af3 Mon Sep 17 00:00:00 2001 From: Brad White Date: Wed, 23 Oct 2024 15:20:04 -0600 Subject: [PATCH] Revert "Fix prepare release notes for Endpoint (#31)" This reverts commit 7416954c98f3dace09d44c13ba27394262363c9d. --- src/common/pr-utils/grouping.ts | 13 ++++--------- src/config/index.ts | 2 +- src/config/templates/endpoint.ts | 6 +++++- src/config/templates/types.ts | 2 +- .../release-notes/components/grouped-pr-list.tsx | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/common/pr-utils/grouping.ts b/src/common/pr-utils/grouping.ts index aafcdf0..12dd8d2 100644 --- a/src/common/pr-utils/grouping.ts +++ b/src/common/pr-utils/grouping.ts @@ -1,5 +1,5 @@ import { PrItem } from '../../common'; -import { Config, AreaDefinition } from '../../config'; +import { Config } from '../../config'; export interface ReleaseNoteGroups { fixes: T; @@ -21,14 +21,9 @@ export function groupByArea(prs: PrItem[], { areas }: Config): GroupedByArea { // TODO: How to handle/track PRs in multiple areas. const grouped = prs.reduce<{ unknown: PrItem[]; areas: { [title: string]: PrItem[] } }>( (grouped, pr) => { - let matchingAreas: AreaDefinition[] = []; - if (!areas || areas.length === 0) { - matchingAreas = [{ title: '', labels: [] }]; - } else { - matchingAreas = areas.filter( - ({ labels }) => labels && pr.labels.some(({ name }) => name && labels.includes(name)) - ); - } + const matchingAreas = areas.filter( + ({ labels }) => labels && pr.labels.some(({ name }) => name && labels.includes(name)) + ); if (matchingAreas.length === 0) { grouped.unknown.push(pr); diff --git a/src/config/index.ts b/src/config/index.ts index c844911..3a0911f 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,2 +1,2 @@ export * from './config'; -export type { TemplateId, Config, AreaDefinition } from './templates'; +export type { TemplateId, Config } from './templates'; diff --git a/src/config/templates/endpoint.ts b/src/config/templates/endpoint.ts index f0464be..f9447e5 100644 --- a/src/config/templates/endpoint.ts +++ b/src/config/templates/endpoint.ts @@ -3,7 +3,11 @@ import type { Config } from './types'; export const endpointTemplate: Config = { repoName: 'endpoint-dev', excludedLabels: ['backport', 'release_note:skip'], - areas: [], + areas: [ + { + title: 'Elastic Endpoint', + }, + ], templates: { pages: { releaseNotes: `[discrete] diff --git a/src/config/templates/types.ts b/src/config/templates/types.ts index aea50f8..348c455 100644 --- a/src/config/templates/types.ts +++ b/src/config/templates/types.ts @@ -1,4 +1,4 @@ -export interface AreaDefinition { +interface AreaDefinition { title: string; labels?: readonly string[]; /** diff --git a/src/pages/release-notes/components/grouped-pr-list.tsx b/src/pages/release-notes/components/grouped-pr-list.tsx index d1329c5..3804c26 100644 --- a/src/pages/release-notes/components/grouped-pr-list.tsx +++ b/src/pages/release-notes/components/grouped-pr-list.tsx @@ -11,7 +11,7 @@ interface Props { export const GroupedPrList: FC = memo(({ groupedPrs, groups, keyPrefix }) => { const sortedGroups = useMemo( - () => (groups ? [...groups].sort((a, b) => a.title.localeCompare(b.title)) : [{ title: '' }]), + () => [...groups].sort((a, b) => a.title.localeCompare(b.title)), [groups] ); return (