Skip to content

Commit

Permalink
Create auto-comment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AVNI-THEEXPLORER authored Jan 15, 2025
1 parent 44ea675 commit 6acaa02
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Automate Issue and PR Responses

on:
issues:
types:
- opened
- closed
pull_request:
types:
- opened
- closed

jobs:
respond-to-events:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Respond to new issues
- name: Respond to new issues
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
run: |
echo "Hey @${{ github.actor }}, Welcome to 💖coffeeShop! 🎊" > comment.txt
echo "Thanks for opening an issue! 🙌 Please wait for the issue to be assigned." >> comment.txt
echo "Happy Coding!! ✨" >> comment.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body-path: comment.txt

# Respond to closed issues
- name: Respond to closed issues
if: ${{ github.event_name == 'issues' && github.event.action == 'closed' }}
run: |
echo "Hello @${{ github.event.issue.user.login }}! Your issue #${{ github.event.issue.number }} has been closed." > comment.txt
echo "Thank you for your contribution to 💖coffeeShop!!! 🙌" >> comment.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body-path: comment.txt

# Respond to new PRs
- name: Respond to new PRs
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }}
run: |
echo "Hey @${{ github.actor }}, Welcome to 💖coffeeShop 🎊" > comment.txt
echo "Thanks for your contribution! Your effort makes this project better. Keep it up! 🙌" >> comment.txt
echo "Please wait for the PR to be reviewed." >> comment.txt
echo "Happy Coding!! ✨" >> comment.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: comment.txt

# Respond to merged PRs
- name: Respond to merged PRs
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged }}
run: |
echo "@${{ github.event.pull_request.user.login }} Congrats, Your pull request has been successfully merged 🥳🎉" > comment.txt
echo "Thank you for your contribution to 💖coffeeShop!!" >> comment.txt
echo "Happy coding 🎊, Keep Contributing 🙌 !!!" >> comment.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: comment.txt

0 comments on commit 6acaa02

Please sign in to comment.