Skip to content

Commit

Permalink
Revert "Fix prepare release notes for Endpoint (#31)"
Browse files Browse the repository at this point in the history
This reverts commit 7416954.
  • Loading branch information
Ikuni17 committed Oct 23, 2024
1 parent 7416954 commit 871c77e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
13 changes: 4 additions & 9 deletions src/common/pr-utils/grouping.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PrItem } from '../../common';
import { Config, AreaDefinition } from '../../config';
import { Config } from '../../config';

export interface ReleaseNoteGroups<T> {
fixes: T;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './config';
export type { TemplateId, Config, AreaDefinition } from './templates';
export type { TemplateId, Config } from './templates';
6 changes: 5 additions & 1 deletion src/config/templates/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/config/templates/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface AreaDefinition {
interface AreaDefinition {
title: string;
labels?: readonly string[];
/**
Expand Down
2 changes: 1 addition & 1 deletion src/pages/release-notes/components/grouped-pr-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Props {

export const GroupedPrList: FC<Props> = 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 (
Expand Down

0 comments on commit 871c77e

Please sign in to comment.