Skip to content

Commit

Permalink
chore: add github action for merged pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
MDeLuise committed Jun 6, 2024
1 parent 8cf28f7 commit bdf0038
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/pr-merge-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Comment on Merged PR

on:
pull_request:
types: [closed]

jobs:
comment-on-pr:
if: >
github.event.pull_request.merged == true &&
github.event.pull_request.user.login != 'dependabot[bot]' &&
github.event.pull_request.user.login != github.repository_owner
runs-on: ubuntu-latest

steps:
- name: Comment on the PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pullRequest = context.payload.pull_request;
const issue_number = pullRequest.number;
const user_login = pullRequest.user.login;
// Check if the author is neither 'dependabot[bot]' nor the repository owner
if (user_login !== 'dependabot[bot]' && user_login !== context.repo.owner) {
const commentBody = `
Hi @${user_login}!
This task has been completed and will be implemented in the next project release.
Thank you for your contribution!
`;
await github.issues.createComment({
...context.repo,
issue_number: issue_number,
body: commentBody.trim()
});
}

0 comments on commit bdf0038

Please sign in to comment.