Skip to content

allow users to customize the PR comment we put on github#115

Merged
levibostian merged 11 commits intomainfrom
customize-the-pr-comment
Dec 17, 2025
Merged

allow users to customize the PR comment we put on github#115
levibostian merged 11 commits intomainfrom
customize-the-pr-comment

Conversation

@levibostian
Copy link
Copy Markdown
Owner

@levibostian levibostian commented Dec 16, 2025

Related GitHub Issues

Problem

Test mode PR comments are awesome, but it would be even more awesome if users could customize what the PR comment content is.

Solution

Users can provide their own string template. Then, we provide an object with a bunch of variables in it, and we can use that to render the comment.

To users who do not use this feature, this feature will feel like a refactor to them where they will continue to see the default PR comment being used.

Testing

  • Added automated tests.
  • Manually tested. If you check this box, provide instructions for others to test, too.

Pushed some testing commits to this PR to make sure that it works as expected.

Notes for reviewers

…ng template engine

deno-library/template doesn't offer support for loops and I'll be needing that allowing users to provide a custom PR comment.

I chose vento because...
- very similar syntax to deno-library/template (using {{...}}) to be simple and easy to use.
- gives more powerful features like loops, conditionals.
- zero dependencies. small. simple.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 16, 2025

decaf

Running deployments in test mode. Results will appear below.
If this pull request and all of it's parent pull requests are merged using the...

...🟩 squash 🟩 merge method... 🌴 It will not trigger a deployment. No new version will be deployed.

Learn more
Latest release: 0.8.0
Commit of latest release: bcfa675

Commits since last release:
- allow users to customize the PR comment we put on github

Related GitHub Issues

Problem

Test mode PR comments are awesome, but it would be even more awesome if users could customize what the PR comment content is.

Solution

Users can provide their own string template. Then, we provide an object with a bunch of variables in it, and we can use that to render the comment.

To users who do not use this feature, this feature will feel like a refactor to them where they will continue to see the default PR comment being used.

Testing

  • Added automated tests.
  • Manually tested. If you check this box, provide instructions for others to test, too.

Pushed some testing commits to this PR to make sure that it works as expected.

Notes for reviewers

...🟩 rebase 🟩 merge method... 🚢 The next version of the project will be: 0.9.0

Learn more
Latest release: 0.8.0
Commit of latest release: bcfa675

Commits since last release:
- refactor: all uses of ventojs in the codebase re-use the util.renderStringTemplate function
- improve error message when ventojs is given an invalid template

The original error message I got when running the code in the CI was talking about regex, which is super confusing when I wasn't passing regex at all.

So, I just think we need to have a better error message in general to help if users encounter a problem.
- test that we can still use default pull request comment template
- fix: escape the pull request template string

When you pass in the template string as a param, there's a good chance that it uses different kinds of quotes inside of it, which then messes with the CLI Bash command that we're running, where we're trying to pass the string into decaf. So, as a way to properly escape that string you pass in, we write to a temporary file and then just pass that file to decaf.
- test if you can pass a template or pr comments
- improve the README pull request comment sample by using a loop
- completely replace contents of PR comment each time, dont append

Because we're using string templates now, we don't want to use the appending feature of appending context to the existing PR comment. We want to completely replace it instead, just because then you don't have to add a bunch of logic to your string template.
- refactor: document usage of ventojs for later reference

to help devs + agents learn ventojs quickly, putting documentation in the code via comments with basic usage.
- feat: customize pull request comment by providing a template string
- add inputs for providing a pull request comment template string. either file or string.
- refactor: replace jsr:deno-library/template with npm:ventojs for string template engine

deno-library/template doesn't offer support for loops and I'll be needing that allowing users to provide a custom PR comment.

I chose vento because...

  • very similar syntax to deno-library/template (using {{...}}) to be simple and easy to use.
  • gives more powerful features like loops, conditionals.
  • zero dependencies. small. simple.

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 16, 2025

Pull Request Test Coverage Report for Build 20304075141

Details

  • 94 of 95 (98.95%) changed or added relevant lines in 7 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.8%) to 80.806%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/github-api.ts 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
index.ts 1 97.06%
Totals Coverage Status
Change from base Build 20208675457: 0.8%
Covered Lines: 1235
Relevant Lines: 1564

💛 - Coveralls

@levibostian levibostian force-pushed the customize-the-pr-comment branch 4 times, most recently from f7e325d to 8e5dbef Compare December 17, 2025 12:41
to help devs + agents learn ventojs quickly, putting documentation in the code via comments with basic usage.
Because we're using string templates now, we don't want to use the appending feature of appending context to the existing PR comment. We want to completely replace it instead, just because then you don't have to add a bunch of logic to your string template.
When you pass in the template string as a param, there's a good chance that it uses different kinds of quotes inside of it, which then messes with the CLI Bash command that we're running, where we're trying to pass the string into decaf. So, as a way to properly escape that string you pass in, we write to a temporary file and then just pass that file to decaf.
@levibostian levibostian force-pushed the customize-the-pr-comment branch from 8e5dbef to 9e2207d Compare December 17, 2025 12:55
The original error message I got when running the code in the CI was talking about regex, which is super confusing when I wasn't passing regex at all.

So, I just think we need to have a better error message in general to help if users encounter a problem.
@levibostian levibostian merged commit ec7c774 into main Dec 17, 2025
7 checks passed
@levibostian levibostian deleted the customize-the-pr-comment branch December 17, 2025 13:35
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.

2 participants