bug: testbug #2841
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 💬 Auto Comment | |
on: | |
issues: | |
types: [opened] | |
pull_request: | |
types: [opened, closed] | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
auto_comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🤖 Auto Comment on Issues and PRs | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const { owner, repo } = context.repo; | |
const author = context.payload.sender.login; | |
try { | |
if (context.eventName === 'issues' && context.payload.action === 'opened') { | |
const issue = await github.rest.issues.get({ | |
owner, | |
repo, | |
issue_number: context.issue.number | |
}); | |
const isFeatureRequest = issue.data.title.toLowerCase().includes('feat'); | |
let commentBody; | |
if (isFeatureRequest) { | |
commentBody = `Hey @${author}! 👋 Thanks for your feature request! 💡 | |
We love hearing new ideas from our community. Here's what happens next: | |
1. 📋 Our team will review your suggestion | |
2. 💬 We might reach out for more details if needed | |
3. 🔍 We'll evaluate how it fits with our roadmap | |
4. 📢 We'll update you on the status | |
Thanks for helping make reNgine even better! 🚀`; | |
} else { | |
commentBody = `Hey @${author}! 👋 Thanks for flagging this! 🐛🐞 | |
Before we dig in, Let's make sure you have: | |
🔍 Gone through the documentation: https://rengine.wiki | |
🕵️ Make sure it's not a known issue | |
📝 Provided us all the details related to this bug`; | |
} | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner, | |
repo, | |
body: commentBody | |
}); | |
} else if (context.eventName === 'pull_request' && context.payload.action === 'opened') { | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner, | |
repo, | |
body: `Woohoo @${author}! 🎉 You've just dropped some hot new code! 🔥 | |
Hang tight while we review this! You rock! 🤘` | |
}); | |
} else if (context.eventName === 'pull_request' && context.payload.action === 'closed') { | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner, | |
repo, | |
body: `Holy smokes, @${author}! 🤯 You've just made reNgine even more awesome! | |
Your code is now part of the reNgine hall of fame. 🏆 | |
Keep the cool ideas coming - maybe next time you'll break the internet! 💻💥 | |
Virtual high fives all around! 🙌` | |
}); | |
} | |
console.log('Comment created successfully'); | |
} catch (error) { | |
console.error('Error creating comment:', error); | |
core.setFailed(`Action failed with error: ${error}`); | |
} |