-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
0 additions
and
117 deletions.
There are no files selected for viewing
102 changes: 0 additions & 102 deletions
102
src/lib/daily-report/get-daily-report-homie-hints-blocks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +0,0 @@ | ||
import { ChatPostMessageArguments } from '@slack/web-api/dist/methods' | ||
import { sample } from 'lodash' | ||
|
||
interface GetDailyReportHomieHintsBlocks { | ||
pendingTasks: Array<{ name: string; html_url: string }> | ||
pullRequests: Array<{ | ||
title: string | ||
contributor_id: number | ||
html_url: string | ||
}> | ||
contributors: Array<{ | ||
username: string | ||
ext_slack_member_id: string | null | ||
id: number | ||
}> | ||
extSlackBotUserId: string | ||
} | ||
|
||
export async function getDailyReportHomieHintsBlocks( | ||
params: GetDailyReportHomieHintsBlocks, | ||
) { | ||
const { pendingTasks, contributors, pullRequests, extSlackBotUserId } = params | ||
|
||
const hintsBlocks: ChatPostMessageArguments['blocks'] = [ | ||
{ | ||
type: 'header', | ||
text: { | ||
type: 'plain_text', | ||
text: 'Homie ⚡️', | ||
emoji: true, | ||
}, | ||
}, | ||
{ | ||
type: 'section', | ||
text: { | ||
type: 'plain_text', | ||
text: 'Do more with Homie, try out some of these commands:', | ||
}, | ||
}, | ||
] | ||
|
||
const hints: string[] = [] | ||
|
||
// Explain PR | ||
const randomPullRequest = sample(pullRequests) | ||
if (randomPullRequest) { | ||
hints.push(`<@${extSlackBotUserId}> explain PR ${randomPullRequest.title}`) | ||
} | ||
|
||
// Assign a task | ||
const contributorToAssign = sample(contributors) | ||
const taskToAssign = sample(pendingTasks) | ||
if ( | ||
contributorToAssign && | ||
contributorToAssign.ext_slack_member_id && | ||
taskToAssign | ||
) { | ||
hints.push( | ||
`<@${extSlackBotUserId}> assign ${taskToAssign.name} to <@${contributorToAssign.ext_slack_member_id}>`, | ||
) | ||
} | ||
|
||
// Generate changelog | ||
hints.push(`<@${extSlackBotUserId}> generate changelog for PRs above.`) | ||
|
||
// Turn PR into blogpost | ||
const blogPostPR = sample(pullRequests) | ||
if (blogPostPR) { | ||
hints.push( | ||
`<@${extSlackBotUserId}> turn PR ${blogPostPR.title} into a blog post.`, | ||
) | ||
} | ||
|
||
// Remember slack thread | ||
hints.push(`<@${extSlackBotUserId}> remember this conversation.`) | ||
|
||
// Ask if a bug was fixed | ||
hints.push(`<@${extSlackBotUserId}> did we fix <some bug>?`) | ||
|
||
// Find all PRs related to some topic | ||
hints.push(`<@${extSlackBotUserId}> find all PRs for <some topic>`) | ||
|
||
for (const hint of hints) { | ||
hintsBlocks.push({ | ||
type: 'section', | ||
text: { | ||
type: 'mrkdwn', | ||
text: `• ${hint}`, | ||
}, | ||
}) | ||
} | ||
|
||
hintsBlocks.push({ | ||
type: 'section', | ||
text: { | ||
type: 'mrkdwn', | ||
text: 'Check out the <https://homie.gg/docs/getting-started|docs> for more features.', | ||
}, | ||
}) | ||
|
||
return hintsBlocks | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters