pr-preview-action icon indicating copy to clipboard operation
pr-preview-action copied to clipboard

Customise comment text

Open rossjrw opened this issue 6 months ago • 2 comments

Relates to https://github.com/rossjrw/pr-preview-action/issues/25#issuecomment-1324184104

It'd be good to be able to customise the text of the comment left by the action.

I figure it should be possible to let the user pass a string argument which can be used as the message for the marocchino/sticky-pull-request-comment step, with the current message string being the default argument.

The user could be able to use this argument to opt-out of the comment, e.g. it could skip the step if the comment is false or if it's an empty string. That behaviour might even make it possible for the user to change whether or not they want to post a comment based on various conditions. Possible use case: user wants to use their own comment/notification mechanism.

I was initially worried about code injection (https://docs.github.com/en/enterprise-cloud@latest/actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections), given that I'd have to pass a string containing variables to be interpolated, but I don't think this is actually a problem at all because the user will write that string in their workflow file and the variables will be interpolated there.

I'm not clear on how to get env variables into the string that will only be known at runtime, though (e.g. ${{ env.pagesurl }} in the current string. Might Just Work with no changes needed, might need some thought.

rossjrw avatar Dec 20 '23 12:12 rossjrw

Just a thought - it might be good idea to have an input to control whether a comment is posted or not. Then, users can customise their comment using marocchino/sticky-pull-request-comment directly with this action's deployment-url output.

josephluck avatar Jan 03 '24 17:01 josephluck

I know you'd like to add a generic solution instead of a hard-coded one, but I think you should really add the "(as soon as GitHub finishes deploying it)" comment I suggested here as soon as possible. I've gotten several comments on my template that uses this action being confused as to why the changes weren't there immediately. Even just saying "will be available soon" (without linking to the pages deployment workflow run) would be great.

Another reason why this is relevant right now:

I thought that GitHub would've really tried to get their own PR preview system up and running ASAP (to take business away from Netlify and the like), but they just recently commented on that discussion saying that it's not coming any time soon (probably not even this year). So unfortunately, this puts more pressure on you because your action is the only thing on the market to accomplish this atm ;)

vincerubinetti avatar Mar 22 '24 23:03 vincerubinetti