feat: include PR/MR URL in DEV completion notifications
Adds automatic PR/MR URL detection and inclusion in DEV completion announcements to provide better visibility into completed work. Changes: 1. TaskManager interface: - Added getMergedMRUrl() method to fetch PR/MR URL for an issue 2. GitHub/GitLab providers: - Implemented getMergedMRUrl() to find most recent merged PR/MR - Returns URL of PR/MR that references the issue number 3. task_complete tool: - Added optional prUrl parameter - Auto-detects PR/MR URL if not provided - Includes PR URL in announcement with 🔗 prefix - Format: 'PR: https://github.com/...' 4. Role templates (dev.md): - Updated to instruct workers to include prUrl in task_complete - Documents that prUrl is optional (auto-detected as fallback) Example announcement: ✅ DEV done #101 — Added PR/MR URL to notifications 🔗 PR: https://github.com/user/repo/pull/102 . Moved to QA queue. Addresses issue #101
This commit is contained in:
@@ -57,6 +57,10 @@ export function createTaskCompleteTool(api: OpenClawPluginApi) {
|
||||
type: "string",
|
||||
description: "Brief summary for group announcement",
|
||||
},
|
||||
prUrl: {
|
||||
type: "string",
|
||||
description: "Pull Request or Merge Request URL (optional, auto-detected if not provided)",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -65,6 +69,7 @@ export function createTaskCompleteTool(api: OpenClawPluginApi) {
|
||||
const result = params.result as "done" | "pass" | "fail" | "refine" | "blocked";
|
||||
const groupId = params.projectGroupId as string;
|
||||
const summary = params.summary as string | undefined;
|
||||
let prUrl = params.prUrl as string | undefined;
|
||||
const workspaceDir = ctx.workspaceDir;
|
||||
|
||||
if (!workspaceDir) {
|
||||
@@ -133,11 +138,34 @@ export function createTaskCompleteTool(api: OpenClawPluginApi) {
|
||||
output.gitPull = `warning: ${(err as Error).message}`;
|
||||
}
|
||||
|
||||
// Auto-detect PR/MR URL if not provided
|
||||
if (!prUrl) {
|
||||
try {
|
||||
prUrl = await provider.getMergedMRUrl(issueId) ?? undefined;
|
||||
} catch (err) {
|
||||
// Ignore errors in PR URL detection
|
||||
}
|
||||
}
|
||||
|
||||
await deactivateWorker(workspaceDir, groupId, "dev");
|
||||
await provider.transitionLabel(issueId, "Doing", "To Test");
|
||||
|
||||
output.labelTransition = "Doing → To Test";
|
||||
output.announcement = `✅ DEV done #${issueId}${summary ? ` — ${summary}` : ""}. Moved to QA queue.`;
|
||||
|
||||
// Build announcement with PR URL if available
|
||||
let announcement = `✅ DEV done #${issueId}`;
|
||||
if (summary) {
|
||||
announcement += ` — ${summary}`;
|
||||
}
|
||||
if (prUrl) {
|
||||
announcement += `\n🔗 PR: ${prUrl}`;
|
||||
}
|
||||
announcement += `. Moved to QA queue.`;
|
||||
|
||||
output.announcement = announcement;
|
||||
if (prUrl) {
|
||||
output.prUrl = prUrl;
|
||||
}
|
||||
|
||||
if (project.autoChain) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user