This file contains hidden or 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 Reply to Issues & PRs | |
| on: | |
| issues: | |
| types: [opened, reopened] | |
| pull_request: | |
| types: [opened, reopened] | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| auto-comment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🧠 Auto Comment | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const eventName = context.eventName; | |
| const repo = context.repo; | |
| if (eventName === "issues") { | |
| const user = context.payload.issue.user.login; | |
| const message = `👋 Hi @${user}! | |
| Thanks for opening an issue in **MyCMD**. | |
| We’ll review it soon — meanwhile, please ensure logs and reproduction steps are clear.`; | |
| await github.rest.issues.createComment({ | |
| owner: repo.owner, | |
| repo: repo.repo, | |
| issue_number: context.issue.number, | |
| body: message | |
| }); | |
| await github.rest.reactions.createForIssue({ | |
| owner: repo.owner, | |
| repo: repo.repo, | |
| issue_number: context.issue.number, | |
| content: "tada" | |
| }); | |
| } | |
| if (eventName === "pull_request") { | |
| const user = context.payload.pull_request.user.login; | |
| const message = `🚀 Hi @${user}! | |
| Thank you for contributing to **MyCMD**. | |
| A maintainer will review your PR shortly. 🎉`; | |
| await github.rest.issues.createComment({ | |
| owner: repo.owner, | |
| repo: repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| body: message | |
| }); | |
| await github.rest.reactions.createForIssue({ | |
| owner: repo.owner, | |
| repo: repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| content: "rocket" | |
| }); | |
| } |