Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 7e90e9f

Browse files
authored
DOP-1338: Add hint to slack message to add docs-builder-bot as collab… (#692)
DOP-1338: Add hint to slack message to add docs-builder-bot as collaborator
1 parent 74ec69f commit 7e90e9f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

api/controllers/v1/jobs.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,13 @@ async function prepSummaryMessage(
184184
return msg.replace(/\.{2,}/g, '');
185185
}
186186

187-
function prepProgressMessage(jobUrl: string, jobId: string, jobTitle: string, status: string): string {
187+
function prepProgressMessage(
188+
jobUrl: string,
189+
jobId: string,
190+
jobTitle: string,
191+
status: string,
192+
errorReason: string
193+
): string {
188194
const msg = `Your Job (<${jobUrl}${jobId}|${jobTitle}>) `;
189195
const env = c.get<string>('env');
190196
switch (status) {
@@ -195,7 +201,13 @@ function prepProgressMessage(jobUrl: string, jobId: string, jobTitle: string, st
195201
case 'completed':
196202
return msg + 'has successfully completed.';
197203
case 'failed':
198-
return msg + 'has failed and will not be placed back in the ' + env + ' queue.';
204+
let failedMessage = msg + 'has failed and will not be placed back in the ' + env + ' queue.';
205+
if (errorReason.match(/Repository not found/)) {
206+
const autobuilderWikiUrl =
207+
'https://wiki.corp.mongodb.com/pages/viewpage.action?spaceKey=DE&title=How-To%3A+Use+Snooty%27s+Autobuilder+to+Build+Your+Content#:~:text=origin%20master%3Astage%2Dmaster-,For%20Private%20repositories,-%3A%20in%20addition%20to';
208+
failedMessage += `\n:point_right: Hint: If your repo is private, have you <${autobuilderWikiUrl}|added the docs-builder-bot as a collaborator?>`;
209+
}
210+
return failedMessage;
199211
default:
200212
return msg + 'has been updated to an unsupported status.';
201213
}
@@ -219,7 +231,13 @@ async function NotifyBuildProgress(jobId: string): Promise<any> {
219231
return;
220232
}
221233
const resp = await slackConnector.sendMessage(
222-
prepProgressMessage(c.get('dashboardUrl'), jobId, jobTitle, fullDocument.status as string),
234+
prepProgressMessage(
235+
c.get('dashboardUrl'),
236+
jobId,
237+
jobTitle,
238+
fullDocument.status as string,
239+
fullDocument?.error?.reason || ''
240+
),
223241
entitlement['slack_user_id']
224242
);
225243
return {

0 commit comments

Comments
 (0)