Skip to content

Conversation

@xkaper001
Copy link
Owner

@xkaper001 xkaper001 commented Oct 19, 2025

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

  • ✨ Created new workflow file .github/workflows/pr-merged-comment.yml
  • 🎯 Workflow triggers only on merged PRs (not just closed ones)
  • 🎉 Implements 5 different randomized thank you messages
  • 👤 Messages are personalized with the contributor's username
  • 🚀 Uses actions/github-script@v8 for reliability

Example Messages

The bot randomly selects from 5 encouraging messages like:

  • "🎉 Awesome work, @username! Your PR has been merged successfully! 🚀"
  • "🌟 Congratulations, @username! Your contribution has been merged! 🎊"
  • And 3 more variations...

Testing

  • Workflow file syntax is correct
  • Only triggers on pull_request.closed with merged == true condition
  • Uses proper permissions (pull-requests: write)

Related Issue

Fixes #35

Checklist

  • Code follows project style guidelines
  • Changes are well-documented
  • Workflow uses latest stable action versions
  • Tested the workflow logic

This will help appreciate and encourage our contributors when their hard work gets merged! 🎊

Summary by CodeRabbit

  • Chores
    • Automated thank-you messages now appear on merged pull requests to acknowledge contributor efforts.

- 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
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 19, 2025

Walkthrough

A 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

Cohort / File(s) Summary
New GitHub Actions Workflow
\.github/workflows/pr-merged-comment\.yml
Introduces workflow triggered on merged PRs. Uses actions/github-script@v8 to post a randomized thank-you comment with contributor's name. Includes predefined message templates and validates github.event.pull_request.merged to ensure execution only on successful merges. Configured with pull-requests write permissions.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🚀 A workflow springs to life so keen,
To thank contributors on the GitHub scene,
When PRs merge with care and grace,
A random cheer fills up the space! ✨

Pre-merge checks

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat: Add automated thank you comment on merged PRs" is clear, specific, and concise. It directly and accurately describes the main change in the changeset—the introduction of a new GitHub Actions workflow that posts automated thank-you comments when PRs are merged. The title uses conventional commit formatting and avoids vague terminology, making it easy for anyone scanning the repository history to understand the primary objective at a glance.
Linked Issues Check ✅ Passed The code changes fully satisfy all acceptance criteria from issue #35. The workflow implementation triggers only on merged PRs through an explicit merged condition check, automatically posts personalized thank-you comments using github-script@v8 action, includes five friendly and encouraging message variations, and explicitly prevents comments on closed-but-unmerged PRs. The implementation demonstrates careful attention to the issue's requirements with proper permissions configuration and verified workflow logic.
Out of Scope Changes Check ✅ Passed All changes in this PR are directly related to the scope defined in issue #35. The single addition of .github/workflows/pr-merged-comment.yml is the exact deliverable required by the linked issue, with no extraneous modifications or unrelated changes detected. The workflow implementation precisely addresses the stated objective of adding an automated thank-you comment feature for merged PRs.
Description Check ✅ Passed The PR description provides comprehensive information covering the main requirements of the template. It clearly states the related issue ("Fixes #35"), explains the rationale for the change, details the specific changes made including the new workflow file, includes testing validation with a checklist, and demonstrates well-structured documentation with examples and emojis for clarity. While the description doesn't follow the exact template section headings verbatim, it contains all essential information needed to understand and review the changes effectively.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.login is available in pull_request.closed events, so that part is good to go.

However, consider these improvements:

  1. 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});
  • });
    
    
  1. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0bdb232 and af81ae4.

📒 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.closed event 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 == true condition acts as a safety net, and the pull-requests: write permission 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. 👍

@xkaper001 xkaper001 added enhancement Improvement to an existing feature. hacktoberfest-accepted labels Oct 19, 2025
@xkaper001 xkaper001 merged commit 0ae4889 into dev Oct 19, 2025
1 of 2 checks passed
@xkaper001 xkaper001 deleted the issue35 branch October 19, 2025 17:01
@github-actions
Copy link

🚀 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! 🌈✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to an existing feature. hacktoberfest-accepted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automated thank you comment on merged PRs

2 participants