|
| 1 | +name: PR Merged Thank You Bot |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + |
| 7 | +jobs: |
| 8 | + thank-contributor: |
| 9 | + # Only run if the PR was merged (not just closed) |
| 10 | + if: github.event.pull_request.merged == true |
| 11 | + permissions: |
| 12 | + pull-requests: write |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Add thank you comment to merged PR |
| 16 | + uses: actions/github-script@v8 |
| 17 | + with: |
| 18 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + script: | |
| 20 | + const messages = [ |
| 21 | + "🎉 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! 💪✨", |
| 22 | + "🌟 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! 🙌💙", |
| 23 | + "🚀 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! 🌈✨", |
| 24 | + "✨ 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! 🏆💻", |
| 25 | + "🎊 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! 💫🙏" |
| 26 | + ]; |
| 27 | + |
| 28 | + const author = context.payload.pull_request.user.login; |
| 29 | + const randomMessage = messages[Math.floor(Math.random() * messages.length)]; |
| 30 | + const personalizedMessage = randomMessage.replace('{author}', author); |
| 31 | + |
| 32 | + github.rest.issues.createComment({ |
| 33 | + issue_number: context.issue.number, |
| 34 | + owner: context.repo.owner, |
| 35 | + repo: context.repo.repo, |
| 36 | + body: personalizedMessage |
| 37 | + }); |
0 commit comments