feat: embed file content in message template via {path} placeholder (#1665)
Some checks failed
Test / test (push) Has been cancelled

* Initial plan

* Add prefix and suffix inputs to wrap comment body

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* feat: support combining path and message inputs using $path placeholder

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* feat: use {path} placeholder and remove prefix/suffix inputs

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* 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>

* fix: when message has no {{{content}}} placeholder, return message as-is

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/b6492aa3-c55c-41f7-b43e-12cc3f2c3002

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* refactor: simplify {{{content}}} replacement — drop includes guard and regex

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/81112a7b-0e6d-4f21-ad36-530af7c0259f

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* chore: remove accidentally committed dist/src/* and add to .gitignore

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/7ced80dd-92a9-46ad-b667-bf5ceaa129ea

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
This commit is contained in:
Copilot 2026-04-24 21:37:42 +09:00 committed by GitHub
parent 64ebf23022
commit ae583cebed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 88 additions and 7 deletions

View file

@ -112,6 +112,22 @@ with:
path: path-to-comment-contents.txt
```
### Embed file content inside a message template
Use `{{{content}}}` as a placeholder in the `message` to insert file content at that position.
````yaml
- name: Run Test
run: rake test > result.txt
- uses: marocchino/sticky-pull-request-comment@v3
with:
path: result.txt
message: |
```
{{{content}}}
```
````
### Delete the previous comment and add a comment at the end
```yaml
@ -220,11 +236,11 @@ For more detailed information about permissions, you can read from the link belo
### `message`
**Optional** Comment message
**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
**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`