From 284654e33def187768c315c5eaefb0c5abf37be5 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Tue, 28 Feb 2023 11:09:17 +0530 Subject: [PATCH] added thankyou note github workflow --- .github/workflows/thank-you.yml | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/thank-you.yml diff --git a/.github/workflows/thank-you.yml b/.github/workflows/thank-you.yml new file mode 100644 index 00000000000..42cd96053c1 --- /dev/null +++ b/.github/workflows/thank-you.yml @@ -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/github-script@v6.3.3 + 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}`, + }) +