From 207e3732e67788467b586925ebdb4f59abc052b7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 11:57:04 +0000 Subject: [PATCH] feat: rename placeholder from {path} to {{{content}}} Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/72744cd4-264e-4c06-95d4-6fdec3446f90 Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com> --- README.md | 8 ++++---- __tests__/config.test.ts | 14 +++++++------- action.yml | 4 ++-- src/config.ts | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 78d7fa7..ca6cc28 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ with: ### Embed file content inside a message template -Use `{path}` as a placeholder in the `message` to insert file content at that position. +Use `{{{content}}}` as a placeholder in the `message` to insert file content at that position. ````yaml - name: Run Test @@ -124,7 +124,7 @@ Use `{path}` as a placeholder in the `message` to insert file content at that po path: result.txt message: | ``` - {path} + {{{content}}} ``` ```` @@ -236,11 +236,11 @@ For more detailed information about permissions, you can read from the link belo ### `message` -**Optional** Comment message. When used together with `path`, use `{path}` as a placeholder in the message where the file content should be inserted. +**Optional** Comment message. When used together with `path`, use `{{{content}}}` as a placeholder in the message where the file content should be inserted. ### `path` -**Optional** Path to file containing comment message. When `message` is also provided and contains `{path}`, the file content is embedded at that placeholder position. +**Optional** Path to file containing comment message. When `message` is also provided and contains `{{{content}}}`, the file content is embedded at that placeholder position. ### `number` diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index 7c25634..b4468cc 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -211,11 +211,11 @@ describe("getBody", () => { expect(core.setFailed).toHaveBeenCalledWith("glob error") }) - test("embeds file content in message when {path} placeholder is used", async () => { + test("embeds file content in message when {{{content}}} placeholder is used", async () => { const {config, core} = await loadConfig() vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/result"]) vi.mocked(core.getInput).mockImplementation(name => { - if (name === "message") return "```\n{path}\n```" + if (name === "message") return "```\n{{{content}}}\n```" return "" }) mockGlobCreate.mockResolvedValue({ @@ -224,11 +224,11 @@ describe("getBody", () => { expect(await config.getBody()).toBe("```\nhi there\n\n```") }) - test("replaces all {path} occurrences in message with file content", async () => { + test("replaces all {{{content}}} occurrences in message with file content", async () => { const {config, core} = await loadConfig() vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/result"]) vi.mocked(core.getInput).mockImplementation(name => { - if (name === "message") return "{path}\n---\n{path}" + if (name === "message") return "{{{content}}}\n---\n{{{content}}}" return "" }) mockGlobCreate.mockResolvedValue({ @@ -237,7 +237,7 @@ describe("getBody", () => { expect(await config.getBody()).toBe("hi there\n\n---\nhi there\n") }) - test("uses file content as body when path is provided but message has no {path} placeholder", async () => { + test("uses file content as body when path is provided but message has no {{{content}}} placeholder", async () => { const {config, core} = await loadConfig() vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/result"]) vi.mocked(core.getInput).mockImplementation(name => { @@ -250,11 +250,11 @@ describe("getBody", () => { expect(await config.getBody()).toBe("hi there\n") }) - test("embeds multiple files content in message when {path} placeholder is used", async () => { + test("embeds multiple files content in message when {{{content}}} placeholder is used", async () => { const {config, core} = await loadConfig() vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/*"]) vi.mocked(core.getInput).mockImplementation(name => { - if (name === "message") return "```\n{path}\n```" + if (name === "message") return "```\n{{{content}}}\n```" return "" }) mockGlobCreate.mockResolvedValue({ diff --git a/action.yml b/action.yml index 064c6cd..8bfec43 100644 --- a/action.yml +++ b/action.yml @@ -52,10 +52,10 @@ inputs: default: "OUTDATED" required: false message: - description: "comment message. When used together with path, use `{path}` as a placeholder in the message where the file content should be inserted." + description: "comment message. When used together with path, use `{{{content}}}` as a placeholder in the message where the file content should be inserted." required: false path: - description: "glob path to file(s) containing comment message. When message is also provided and contains `{path}`, the file content is embedded at that placeholder position." + description: "glob path to file(s) containing comment message. When message is also provided and contains `{{{content}}}`, the file content is embedded at that placeholder position." required: false ignore_empty: description: "Indicates whether to ignore missing or empty messages" diff --git a/src/config.ts b/src/config.ts index 24ab94c..8c3f977 100644 --- a/src/config.ts +++ b/src/config.ts @@ -61,8 +61,8 @@ export async function getBody(): Promise { const fileContent = (await globber.glob()) .map(path => readFileSync(path, "utf-8")) .join("\n") - if (messageInput && messageInput.includes("{path}")) { - return messageInput.replace(/\{path\}/g, fileContent) + if (messageInput && messageInput.includes("{{{content}}}")) { + return messageInput.replace(/\{\{\{content\}\}\}/g, fileContent) } return fileContent } catch (error) {