Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 4b6c016

Browse files
committed
Enforce remove/Recently Merged on close/merge
1 parent 735fa2c commit 4b6c016

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/compute-pr-actions.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,24 @@ export const LabelNames = [
4848
...StalenessKinds
4949
] as const;
5050

51-
export interface Actions {
52-
projectColumn?: ColumnName | "REMOVE";
51+
export type Actions = {
5352
labels: LabelName[];
5453
responseComments: Comments.Comment[];
55-
state?: "close" | "merge";
5654
shouldUpdateLabels: boolean;
57-
}
55+
} & (
56+
| {
57+
state?: never;
58+
projectColumn?: ColumnName | "REMOVE";
59+
}
60+
| {
61+
state: "close";
62+
projectColumn: "REMOVE";
63+
}
64+
| {
65+
state: "merge";
66+
projectColumn: "Recently Merged";
67+
}
68+
);
5869

5970
function createDefaultActions(): Actions {
6071
return {
@@ -65,14 +76,6 @@ function createDefaultActions(): Actions {
6576
};
6677
}
6778

68-
function createEmptyActions(): Actions {
69-
return {
70-
labels: [],
71-
responseComments: [],
72-
shouldUpdateLabels: false,
73-
};
74-
}
75-
7679
type Staleness = {
7780
readonly kind: StalenessKind;
7881
readonly days: number;
@@ -223,7 +226,9 @@ export function process(prInfo: BotResult,
223226
extendedCallback: (info: ExtendedPrInfo) => void = _i => {}): Actions {
224227
if (prInfo.type === "remove") {
225228
return {
226-
...createEmptyActions(),
229+
labels: [],
230+
responseComments: [],
231+
shouldUpdateLabels: false,
227232
projectColumn: prInfo.isDraft ? "Needs Author Action" : "REMOVE",
228233
};
229234
}

0 commit comments

Comments
 (0)