Production Release | January Week 3 #1089
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
name: Say thanks for the contributors | |
on: | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
if_merged: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
pull-requests: write | |
contents: 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, user } = result.data | |
const assignees_tagged = assignees.map((user) => '@' + user.login).join(' ') | |
const owner_tagged = '@' + user.login | |
if (assignees.length == 0) { | |
await github.rest.issues.createComment({ ...options, body: `${owner_tagged} ${thankyouNote}` }) | |
} else { | |
await github.rest.issues.createComment({ ...options, body: `${assignees_tagged} ${owner_tagged} ${thankyouNote}` }) | |
} |