-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add github action for merged pull requests
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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() | ||
}); | ||
} |