Skip to content

Commit d830251

Browse files
Merge pull request #97 from GoHighLevel/feature/assign-clickup-tasks-to-managers
Feature/assign clickup tasks to managers
2 parents 8f5d262 + e8ff8c6 commit d830251

1 file changed

Lines changed: 62 additions & 2 deletions

File tree

.github/process-issue.js

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,43 @@ const API_ISSUE_TYPE_SLA_DAYS = {
163163
"New Products": 20
164164
};
165165

166+
// Manager to ClickUp User ID Mapping
167+
// Generated on: 2025-01-29T08:47:14.054Z
168+
// Updated with email pattern matching verification
169+
const MANAGER_TO_CLICKUP_USER_ID = {
170+
"Abhishek": "84039776",
171+
"Abhishek Maheshwari": "44147964",
172+
"Ajay Dev": "89021250",
173+
"Ankit Jain": "61208277",
174+
"Anurag Singh": "89077861",
175+
"Anwar": "89021242",
176+
"Arvind": "94818265",
177+
"Baibhab": "7816084",
178+
"Daljeet Singh": "55354445",
179+
"Debayan": "88876236",
180+
"Dhruv": "95075364",
181+
"Gaurav Kanted": "49407057",
182+
"Harsh Kurra": "5975441",
183+
"Harsh Tomar": "50190049",
184+
"Hemant": "5447247",
185+
"Hemant Goyal": "73224171",
186+
"Jees": "63077932",
187+
"Manish KR": "88856048",
188+
"Mayur": "5971589",
189+
"Neha": "61231059",
190+
"Nikita": "95078996",
191+
"Pranoy Sarkar": "16804265",
192+
"Ravi": "61368010",
193+
"Sai Allu": "88952037",
194+
"Sayeed": "7836399",
195+
"Shivendra": "94952187",
196+
"Sunil": "57188581",
197+
"Upamanyu Sarangi": "57190023",
198+
"Vatsal Mehta": "50232305",
199+
"Vinamra Sareen": "88930302",
200+
"Yogesh": "7310064"
201+
};
202+
166203
// Helper function to retry failed API calls
167204
async function retryOperation(operation, maxRetries = 3, delay = 1000) {
168205
let lastError;
@@ -309,7 +346,18 @@ async function createClickUpTask(issueData, productInfo, apiIssueTypeValue, dueD
309346
};
310347

311348
const taskName = issueData.title;
312-
const description = `GitHub Issue: #${issueData.number}\nLink: ${issueData.html_url}\n\n--- Issue Details ---\n${issueData.body || "No description provided."}\n\n⚠️ Important: Please do not close this ClickUp task directly. The task will be automatically closed when the corresponding GitHub issue is closed.`;
349+
350+
// Build product area details section
351+
const productAreaDetails = [
352+
`📦 **Product Area Details**`,
353+
`- **Product**: ${productInfo.product || 'N/A'}`,
354+
`- **Team**: ${productInfo.team || 'N/A'}`,
355+
`- **Sub-team**: ${productInfo.sub_team || 'N/A'}`,
356+
`- **Engineering Manager**: ${productInfo.em || 'Not assigned'}`,
357+
''
358+
].join('\n');
359+
360+
const description = `GitHub Issue: #${issueData.number}\nLink: ${issueData.html_url}\n\n${productAreaDetails}\n--- Issue Details ---\n${issueData.body || "No description provided."}\n\n⚠️ Important: Please do not close this ClickUp task directly. The task will be automatically closed when the corresponding GitHub issue is closed.`;
313361

314362
const payload = {
315363
name: taskName,
@@ -327,6 +375,15 @@ async function createClickUpTask(issueData, productInfo, apiIssueTypeValue, dueD
327375
]
328376
};
329377

378+
// Try to assign the manager if they have a mapped ClickUp user ID
379+
if (productInfo.em && MANAGER_TO_CLICKUP_USER_ID[productInfo.em]) {
380+
const userId = MANAGER_TO_CLICKUP_USER_ID[productInfo.em];
381+
payload.assignees = [userId];
382+
console.log(`Assigned task to manager: ${productInfo.em} (ID: ${userId})`);
383+
} else if (productInfo.em) {
384+
console.log(`No ClickUp user ID mapped for manager: ${productInfo.em}`);
385+
}
386+
330387
const response = await axios.post(url, payload, {
331388
headers,
332389
timeout: 10000
@@ -555,7 +612,10 @@ async function processIssue(github, context, core) {
555612
const createdTask = await createClickUpTask(issueData, productInfo, apiIssueTypeValue, dueDateMs);
556613

557614
if (createdTask && createdTask.id) {
558-
const message = `New GitHub Issue Processed: #${issueData.number} ${issueData.title}\nGitHub URL: ${issueData.html_url}}`;
615+
// Construct ClickUp task URL
616+
const clickupTaskUrl = createdTask.url || `https://app.clickup.com/t/${CLICKUP_LIST_ID}/${createdTask.id}`;
617+
618+
const message = `New GitHub Issue Processed: #${issueData.number} ${issueData.title}\nGitHub URL: ${issueData.html_url}\nClickUp Task Created: ${clickupTaskUrl}\nDue Date: ${dueDateStr}`;
559619

560620
// Send Slack notification (always send, even in dry run)
561621
await sendSlackNotification(message, productInfo);

0 commit comments

Comments
 (0)