Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix prepare release notes for Endpoint (#31)" #32

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading