Skip to content

Commit 3734ce1

Browse files
committed
feat: add bitbucket cloud support
Signed-off-by: Adam Setch <[email protected]>
1 parent 3fcc1f3 commit 3734ce1

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/utils/notifications.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,37 @@ export async function getAllNotifications(
135135
.filter((response) => !!response)
136136
.map(async (accountNotifications) => {
137137
try {
138+
// TODO - this needs to be correctly implemented
138139
if (accountNotifications.account.platform === 'Bitbucket Cloud') {
139-
console.log(
140-
JSON.stringify(await accountNotifications.notifications),
141-
);
140+
const pulls =
141+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
142+
((await accountNotifications.notifications).data as any)
143+
.pullRequests.authored;
144+
145+
console.log(JSON.stringify(pulls, null, 2));
146+
147+
const notifications = pulls.map((pull: any) => ({
148+
id: 1,
149+
reason: 'pull_request',
150+
repository: {
151+
full_name: pull.links.html.href,
152+
owner: {
153+
avatar_url:
154+
'https://avatars.githubusercontent.com/u/987654321?v=4',
155+
},
156+
},
157+
subject: {
158+
title: pull.extra.commit_statuses[0].key,
159+
url: pull.links.html.href,
160+
},
161+
account: accountNotifications.account,
162+
}));
163+
164+
return {
165+
account: accountNotifications.account,
166+
notifications: notifications,
167+
error: null,
168+
};
142169
} else {
143170
let notifications = (
144171
await accountNotifications.notifications

0 commit comments

Comments
 (0)