Skip to content

Commit 1098ccf

Browse files
committed
fix(github): preserve PR body after attribution
Worked on by: - @steipete
1 parent 667b22f commit 1098ccf

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/gateway/github-publication-attribution.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe("Gateway GitHub publication attribution", () => {
4040
agentId: "main",
4141
idempotencyKey: "ordered-attribution",
4242
title: "fix: publish the reconciled fix",
43-
body: "Detailed proof\n\n## Worked on by\n\n- @untrusted\n\n---\n[View the OpenClaw team session](https://untrusted.example/session)",
43+
body: "Detailed proof\n\n## Worked on by\n\n- @untrusted\n\n### Verification notes\n\nKeep this paragraph.\n\n---\n[View the OpenClaw team session](https://untrusted.example/session)",
4444
});
4545

4646
expect(result).toMatchObject({ status: "published" });
@@ -50,7 +50,7 @@ describe("Gateway GitHub publication attribution", () => {
5050
const post = commandCalls.find(({ argv }) => argv.includes("POST"));
5151
expect(JSON.parse(post?.input ?? "null")).toEqual({
5252
title: "fix: publish the reconciled fix",
53-
body: `Detailed proof\n\n## Worked on by\n\n- @alice\n- @grace\n\n<!-- openclaw-publication:${result.requestId} -->\n\n---\n[View the OpenClaw team session](https://team.example/control/chat/main/dashboard/publication)`,
53+
body: `Detailed proof\n\n### Verification notes\n\nKeep this paragraph.\n\n## Worked on by\n\n- @alice\n- @grace\n\n<!-- openclaw-publication:${result.requestId} -->\n\n---\n[View the OpenClaw team session](https://team.example/control/chat/main/dashboard/publication)`,
5454
head: `openclaw:${BRANCH}`,
5555
base: "main",
5656
draft: true,

‎src/gateway/github-publication-executor.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,10 @@ export async function executeGitHubPublication(params: {
608608
row.body?.trim() || "Published by the Gateway after authoritative workspace reconciliation."
609609
)
610610
.replace(/(?:\s*---\s*\n\[View the OpenClaw team session\]\([^\r\n)]*\)\s*)+$/u, "")
611-
.replace(/(?:^|\n\n)## Worked on by(?:\n(?!## )[^\n]*)*/gu, "")
611+
.replace(
612+
/(?:^|\n\n)## Worked on by\n\n(?:- @[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\n)*- @[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})(?=\n\n|$)/gu,
613+
"",
614+
)
612615
.trimEnd();
613616
const participantCredit = contributorCredit
614617
? `\n\n## Worked on by\n\n${contributorCredit}`

0 commit comments

Comments
 (0)