Skip to content

feat: embed file content in message template via {path} placeholder#1665

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/wrap-file-output-with-triple-backticks
Draft

feat: embed file content in message template via {path} placeholder#1665
Copilot wants to merge 4 commits intomainfrom
copilot/wrap-file-output-with-triple-backticks

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

Wrapping file output in a code block previously required piping through $GITHUB_ENV with a heredoc. This adds support for using both path and message together, embedding file content via a {path} placeholder.

Changes

  • src/config.ts: When path and message are both provided and message contains {path}, file content is substituted at every occurrence. Falls back to existing behavior (file content used directly) when no placeholder is present.
  • action.yml: Removed prefix/suffix inputs; updated message and path descriptions to document the placeholder.
  • README.md: Added usage example; updated input reference docs.
  • __tests__/config.test.ts: Tests for single-file embed, multi-occurrence replacement, multi-file glob, and no-placeholder fallback.

Usage

- name: Run Test
  run: rake test > result.txt

- uses: marocchino/sticky-pull-request-comment@v3
  with:
    path: result.txt
    message: |
      ```
      {path}
      ```

{path} is intentionally brace-style (not $path) — safe from shell expansion and unlikely to appear in normal message text.

Original prompt

This section details on the original issue you should resolve

<issue_title>Wrap file output with triple backticks (`)</issue_title>
<issue_description>What's the simplest way to take the output of a file and wrap it with a prefix/suffix like ``` so it ends up like:

    ```
    <file.txt output>
    ```
```</issue_description>

<agent_instructions>이거좀 구현해봐 줄레?
탬플릿 인젝션같은 시큐리티 이슈는 없었으면 좋겠어.
먼저 아이디어를 이야기해주면 어떻게 구현할지 그중에서 정하는 방식으로 하자.</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
Copilot AI changed the title [WIP] Wrap file output with triple backticks Add prefix and suffix inputs to wrap comment body Mar 13, 2026
Copilot AI requested a review from marocchino March 13, 2026 12:53
Copilot stopped work on behalf of marocchino due to an error March 13, 2026 12:57
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
Copilot AI changed the title Add prefix and suffix inputs to wrap comment body feat: embed file content in message template via $path placeholder Mar 13, 2026
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
Copilot AI changed the title feat: embed file content in message template via $path placeholder feat: embed file content in message template via {path} placeholder Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap file output with triple backticks (`)

2 participants