Skip to content

Commit ebf938f

Browse files
committed
feat(events): handle ReleaseEvent
1 parent bdcc763 commit ebf938f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/store/events.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const TARGET_EVENTS = [
1414
"MemberEvent",
1515
"PublicEvent",
1616
"PullRequestEvent",
17+
"ReleaseEvent",
1718
"WatchEvent"
1819
] as const;
1920
const FILTERED_ACTIONS = [
@@ -25,6 +26,7 @@ function getActionString({ type, payload }: RawEvent): string {
2526
switch (type) {
2627
case "ForkEvent": return "forked";
2728
case "IssuesEvent": return `${payload.action} issue`;
29+
case "ReleaseEvent": return `${payload.action} release`;
2830
case "MemberEvent": return "joined";
2931
case "PublicEvent": return "made public";
3032
case "PullRequestEvent": return `${payload.action} pull request`;
@@ -47,6 +49,10 @@ function composeEventUrl(event: RawEvent): string | null {
4749
const html_url = `https://github.com/${event.repo.name}/pull/${number}`;
4850
return `<a href="${html_url}" rel="noopener noreferrer" title="Go to pull request">#${number}</a> in `;
4951
}
52+
if (event.type === "ReleaseEvent" && "release" in event.payload) {
53+
const { html_url, name } = event.payload.release as { html_url: string, name: string };
54+
return `<a href="${html_url}" rel="noopener noreferrer" title="Go to release">${name}</a> in `;
55+
}
5056
return null;
5157
}
5258

0 commit comments

Comments
 (0)