-
Notifications
You must be signed in to change notification settings - Fork 15
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 customize Clubhouse story title and body #10
feat: Add ability to customize Clubhouse story title and body #10
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments for suggested changes, and this pull request needs some automated tests, as well. But I really like where this is going, and I think it will be a useful feature and ready to merge soon! 🎉
src/util.ts
Outdated
storyTitle: string, | ||
storyBody: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than making this function accept arguments for storyTitle
and storyBody
, could you please construct those values inside the createClubhouseStory
function? That keeps the opened.ts
file clearer, and allows for easier testing, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@singingwolfboy, the title
and description
for the story are now in the createClubhouseStory
method.
src/opened.ts
Outdated
"clubhouse-story-title-template" | ||
); | ||
const storyTitle = Mustache.render(CLUBHOUSE_STORY_TITLE_TEMPLATE, { | ||
payload, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than passing the payload
object to the Mustache environment, I think it's clearer to pass the pull request object, like this:
{ pullRequest: payload.pull_request }
I doubt that template authors will need any other information from the payload. I'm undecided about pullRequest
vs pull_request
, but I feel like the former is more Javascripty, so that's why I'm leaning towards it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@singingwolfboy, I debated this too thinking pull_request
would have everything I would want to use, but then when I tried to do what I was doing before of concatenating the repo.name
to the Clubhouse story, it was missing in the payload.pull_request
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't consider that! Alright, then I guess the payload
object is the way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Leaving payload
whole as the passed attribute.
@@ -83,6 +83,35 @@ template output valid Markdown, as shown above. | |||
If you don't provide a comment template, this action will use this comment template | |||
by default: `Clubhouse story: {{{ story.app_url }}}` | |||
|
|||
## Customizing the Clubhouse Story Title and Body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thank you for adding this documentation 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
README.md
Outdated
variables, like this: | ||
|
||
```yaml | ||
- uses: singingwolfboy/create-linked-clubhouse-story@v1.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave this at v1.5
for now. I'll update all the version references in this file when I release a new version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! No problem!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@singingwolfboy, what did you have envisioned for the automated tests for the |
Thanks for all your work on this! I think I'll just merge this, and write some tests myself. |
Here are the tests I put together: 5130a7f Getting everything to work right with |
@singingwolfboy, this PR has a feature that includes the ability for users of this GitHub Action to customize the title and body of the created Clubhouse story using the same custom comment template you're using for the PR comments. If neither
clubhouse-story-title-template
norclubhouse-story-body-template
is populated, it simple defaults to thepayload.pull_request.title
andpayload.pull_request.body
as requested.