Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/pr-merged-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR Merged Thank You Bot

on:
pull_request:
types: [closed]

jobs:
thank-contributor:
# Only run if the PR was merged (not just closed)
if: github.event.pull_request.merged == true
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Add thank you comment to merged PR
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const messages = [
"πŸŽ‰ Awesome work, @{author}! Your PR has been merged successfully! πŸš€\n\nThank you for contributing to DocPilot and making it better for everyone! Your efforts are truly appreciated. Keep up the great work! πŸ’ͺ✨",
"🌟 Congratulations, @{author}! Your contribution has been merged! 🎊\n\nYour dedication to improving DocPilot is amazing! Thank you for being part of our community. We're lucky to have contributors like you! πŸ™ŒπŸ’™",
"πŸš€ Fantastic job, @{author}! Your PR is now merged! 🎯\n\nEvery contribution makes DocPilot stronger, and yours is no exception! Thank you for your valuable input and keep the awesome PRs coming! 🌈✨",
"✨ Amazing contribution, @{author}! Successfully merged! πŸŽ‰\n\nYour code is now part of DocPilot! Thank you for sharing your expertise and helping us build something great together! πŸ†πŸ’»",
"🎊 Well done, @{author}! Your PR has been merged into the project! πŸš€\n\nThank you for your hard work and dedication! Contributors like you make open source truly special. Keep being awesome! πŸ’«πŸ™"
];

const author = context.payload.pull_request.user.login;
const randomMessage = messages[Math.floor(Math.random() * messages.length)];
const personalizedMessage = randomMessage.replace('{author}', author);

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: personalizedMessage
});