-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39000ec
commit 284654e
Showing
1 changed file
with
45 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,45 @@ | ||
name: Say thanks for the contributors | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
if_merged: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
permissions: | ||
issues: write | ||
steps: | ||
- name: Add thankyou note | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
const thankyouNote = 'We truly appreciate your efforts. Thank you for taking the time to contribute, this is a very valuable contribution to us :1st_place_medal:. We always welcome your contribution :slightly_smiling_face:, so feel free to contribute to anything anytime, and never lose that spirit of innovation :raised_hands:.' | ||
const options = { | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
} | ||
const result = await github.rest.issues.get({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
const { assignees } = result.data | ||
if (assignees.length == 0) { | ||
await github.rest.issues.createComment({ ...options, body }) | ||
return | ||
} | ||
const assignees_tagged = assignees.map((user) => '@' + user.login).join(' ') | ||
await github.rest.issues.createComment({ | ||
...options, | ||
body: `${assignees_tagged} ${thankyouNote}`, | ||
}) | ||