Skip to content

Commit 74d273b

Browse files
authored
feat(evergreen-it): set titles
Allow users to set a title when evergreening issues
2 parents 06bebee + 92bb6c9 commit 74d273b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/events/message_create.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export async function evergreenIssueWorkflow(message: Message) {
2828
if (!message.content.toLowerCase().startsWith(EVERGREEN_CREATE_ISSUE_STRING))
2929
return;
3030

31+
32+
3133
let original: Message;
3234

3335
if (!message.reference || !message.reference.messageId) {
@@ -49,7 +51,12 @@ export async function evergreenIssueWorkflow(message: Message) {
4951
].filter(Boolean);
5052

5153
// TODO(rayhanadev): generate title using groq
52-
const title = `Evergreen request from @${people[message.author.id] ?? message.author.tag} in #${message.channel.name}`;
54+
let title = `Evergreen request from @${people[message.author.id] ?? message.author.tag} in #${message.channel.name}`;
55+
56+
if (message.content.match(/^evergreen it\s?/i)) {
57+
title = (message.content.replace(/^evergreen it\s?/i, "") + ` - @${people[message.author.id] ?? message.author.tag} in #${message.channel.name}`).substring(0, 255) // Limit 0-255 to accomadate Github's 256 Issue Title Length Limit
58+
}
59+
5360
const body = `**@${people[original.author.id] ?? original.author.tag}**[^1] said in **[#${message.channel.name}](<${message.url}>)**:
5461
5562
${original.content

0 commit comments

Comments
 (0)