PR complete a task
Change-Id: Icb3f24db0ccd2914a528370d96b8c21168b24e98
diff --git a/server/git/webhook.go b/server/git/webhook.go
index df12492..285ea28 100644
--- a/server/git/webhook.go
+++ b/server/git/webhook.go
@@ -281,14 +281,14 @@
webhook.PullRequest.Head != nil
}
-// ExtractTaskID extracts task ID from branch name like "solution/{task-id}" or "subtasks/{task-id}"
+// ExtractTaskID extracts task ID from branch name like "solution/[task-id]-title" or "subtasks/[task-id]-title"
func ExtractTaskID(branchName string) (string, error) {
- // Match patterns like "solution/task-123", "subtasks/task-456", etc.
- re := regexp.MustCompile(`^(?:solution|subtasks)/(.+)$`)
+ // Match patterns like "solution/[task-123]-title", "subtasks/[task-456]-description", etc.
+ re := regexp.MustCompile(`^(?:solution|subtasks)/\[([^\]]+)\]-.+$`)
matches := re.FindStringSubmatch(branchName)
if len(matches) != 2 {
- return "", fmt.Errorf("branch name '%s' does not match expected pattern (solution/{task-id} or subtasks/{task-id})", branchName)
+ return "", fmt.Errorf("branch name '%s' does not match expected pattern (solution/[task-id]-title or subtasks/[task-id]-title)", branchName)
}
return matches[1], nil