Skip to content

Commit

Permalink
Merge pull request #224 from aditiverma-21/main
Browse files Browse the repository at this point in the history
Implement a Github Workflow for Issues and PR Auto-comment
  • Loading branch information
TenzDelek authored Nov 8, 2024
2 parents e5ca3ce + 2df32e9 commit e07b586
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/PR-auto-cmment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: PR Auto-comment

on:
pull_request:
types:
- opened
- closed

jobs:
auto_comment:
runs-on: ubuntu-latest
steps:
- name: Comment on PR when opened
if: github.event.action == 'opened'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Thank you for opening this Pull Request! We appreciate your effort and contribution to improving our project. Please ensure you’ve followed all the guidelines and that your PR meets our contribution standards. Happy coding! 🚀`
})
- name: Comment on PR when merged
if: github.event.action == 'closed' && github.event.pull_request.merged == true
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `This Pull Request has been successfully merged! 🎉 Thank you for your contribution and for helping us improve the project. We look forward to more contributions from you! 🚀`
})
- name: Comment on PR when closed without merging
if: github.event.action == 'closed' && github.event.pull_request.merged == false
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `This Pull Request was closed without merging. Thank you for your efforts! If there's anything we can do to help with future contributions, let us know. Happy coding! 🚀`
})
35 changes: 35 additions & 0 deletions .github/workflows/issue-auto-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Issue Auto-comment

on:
issues:
types:
- opened
- closed

jobs:
auto_comment:
runs-on: ubuntu-latest
steps:
- name: Comment on Issue when opened
if: github.event.action == 'opened'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: `Thanks for opening this issue! We appreciate your contribution. Please make sure you’ve provided all the necessary details and screenshots, and don't forget to follow our Guidelines and Code of Conduct. Happy coding! 🚀`
})
- name: Comment on Issue when closed
if: github.event.action == 'closed'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: `This issue has been successfully closed. Thank you for your contribution and helping us improve the project! If you have any more ideas or run into other issues, feel free to open a new one. Happy coding! 🚀`
})

0 comments on commit e07b586

Please sign in to comment.