Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to set custom comment content #15

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

wschurman
Copy link
Contributor

Why

For mobile notifications that have limited space, the default comment content doesn't optimize for information density. This PR allows overriding the default attribution link. Attribution to the original repo is useful, though, so this PR also allows supplying a custom footer so one can specify the attribution to be posted there (maybe even link to the action itself) (we do something like this in the expo github action: https://github.com/expo/expo-github-action/blob/8108b8660bffafbf7b8132b1b108219f2269f2a0/src/actions/preview.ts#L207)

How

Add configuration value to allow overriding the default preamble and epilogue of the comment content.

Test Plan

Run all tests (updated to test this configuration).

@wschurman wschurman marked this pull request as ready for review October 7, 2024 23:15
src/comment-upserter.ts Outdated Show resolved Hide resolved
'| File Patterns | Mentions |',
'| - | - |\n'
].join('\n')
export const HEADER = '<!-- codemention header -->'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably an extremely nitpicky thing, but I believe this comment header will no longer have a newline character separating it from the content afterwards. It probably doesn't make a difference when the content is rendered, but I do prefer a newline afterwards.

Copy link
Contributor Author

@wschurman wschurman Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Removing this is a hypothesis about what is responsible for the extra newline behavior we were seeing in the iOS notification:

img_0757_720-2

It doesn't seem to affect the comment on the web, just the one in a notification.

Let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, here's another github app notification for a normal review request:
Screenshot 2024-10-07 at 2 27 06 PM

(note that the newlines between "Why" and the rest of the content are expected and part of the summary)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, then I think it makes sense to not have the newline after the comment.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, after merging and testing this, it looks like the link doesn't render correctly on tobyhs/codemention-test#8 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Yep, definitely something up. Feel free to revert and I'll test more tomorrow and find a fix!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: #16

(going to move the header into a footer to fix both issues in a follow-up)

@wschurman wschurman requested a review from tobyhs October 8, 2024 01:47
Copy link
Owner

@tobyhs tobyhs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

'| File Patterns | Mentions |',
'| - | - |\n'
].join('\n')
export const HEADER = '<!-- codemention header -->'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, then I think it makes sense to not have the newline after the comment.

@tobyhs tobyhs merged commit e2f98a8 into tobyhs:main Oct 8, 2024
1 of 2 checks passed
tobyhs added a commit to tobyhs/codemention-test that referenced this pull request Oct 8, 2024
@wschurman wschurman deleted the add-custom-content-config branch October 8, 2024 16:17
tobyhs added a commit to tobyhs/codemention-test that referenced this pull request Oct 8, 2024
tobyhs added a commit to tobyhs/codemention-test that referenced this pull request Oct 8, 2024
tobyhs added a commit to tobyhs/codemention-test that referenced this pull request Oct 8, 2024
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