-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Add automated thank you comment on merged PRs #36
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
Conversation
- Created GitHub Action workflow to auto-comment on merged PRs - Workflow triggers only when PRs are merged (not just closed) - Implements 5 randomized encouraging thank you messages - Messages are personalized with contributor's username - Adds appreciation and encouragement for contributors - Uses actions/github-script@v8 Fixes #35
WalkthroughA new GitHub Actions workflow is introduced that automatically posts a personalized thank-you comment to pull requests upon merge. The workflow triggers on PR close events, validates merge status, and uses a random selection of encouraging messages with the contributor's name. Changes
Sequence DiagramsequenceDiagram
actor Contributor
participant GitHub as GitHub Platform
participant Workflow as Workflow Engine
participant Script as Script Action
Contributor->>GitHub: Merge PR
GitHub->>Workflow: Trigger on pull_request closed event
Workflow->>Script: Execute (if merged == true)
Script->>Script: Select random message
Script->>Script: Substitute author placeholder
Script->>GitHub: Post comment to PR
GitHub->>Contributor: Notify with thank-you comment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/pr-merged-comment.yml (1)
28-37: Add error handling and use.replaceAll()for robustness.The context variable
context.payload.pull_request.user.loginis available inpull_request.closedevents, so that part is good to go.However, consider these improvements:
- Error handling: Wrap the API call in error handling to catch failures gracefully:
github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: personalizedMessage
- });
- }).catch(err => {
- core.setFailed(
Failed to post thank you comment: ${err.message});- });
- Minor: Replace
.replace('{author}', author)with.replaceAll('{author}', author)to be defensive against future message tweaks that might add multiple placeholders.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pr-merged-comment.yml(1 hunks)
🔇 Additional comments (3)
.github/workflows/pr-merged-comment.yml (3)
3-5: Workflow trigger configuration looks solid.The
pull_request.closedevent with the merge guard at line 10 ensures the workflow only fires for merged PRs, not just any closed PR. This matches the PR objectives perfectly.
8-12: Job permissions and conditional guard are correct.The
if: github.event.pull_request.merged == truecondition acts as a safety net, and thepull-requests: writepermission is appropriately scoped for posting comments.
20-26: Message variety and personalization are great.The five personalized messages add nice variety to the contributor experience. The emoji usage is tasteful and the messages are genuinely encouraging without being over-the-top. 👍
|
🚀 Fantastic job, @xkaper001! Your PR is now merged! 🎯 Every contribution makes DocPilot stronger, and yours is no exception! Thank you for your valuable input and keep the awesome PRs coming! 🌈✨ |
Description
This PR adds a GitHub Action workflow that automatically posts a cool and encouraging thank you comment when a PR gets merged.
Changes Made
.github/workflows/pr-merged-comment.ymlactions/github-script@v8for reliabilityExample Messages
The bot randomly selects from 5 encouraging messages like:
Testing
pull_request.closedwithmerged == trueconditionpull-requests: write)Related Issue
Fixes #35
Checklist
This will help appreciate and encourage our contributors when their hard work gets merged! 🎊
Summary by CodeRabbit