Skip to content

Commit 2447f37

Browse files
authored
Add GitHub Action to comment on merged PRs
1 parent 563433f commit 2447f37

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Auto Comment on PR Merged
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
comment:
12+
if: github.event.pull_request.merged == true
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Add Comment to Merged Pull Request
16+
uses: actions/github-script@v6
17+
with:
18+
script: |
19+
const prNumber = context.issue.number;
20+
const prAuthor = context.payload.pull_request.user.login;
21+
22+
const commentBody = `🎉 Congrats @${prAuthor} on getting your PR merged! 🙌
23+
Thanks for the contribution — looking forward to more from you 🚀`;
24+
25+
await github.rest.issues.createComment({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
issue_number: prNumber,
29+
body: commentBody
30+
});

0 commit comments

Comments
 (0)