From b02421ff9f47d17b9f29f28d8f560f91502ac11c Mon Sep 17 00:00:00 2001 From: Siddheya Kulkarni <115717746+Asymtode712@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:55:43 +0530 Subject: [PATCH] Added auto commenting workflow when an issue is closed (#1028) --- .github/workflows/issue-close-comment.yml | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/issue-close-comment.yml diff --git a/.github/workflows/issue-close-comment.yml b/.github/workflows/issue-close-comment.yml new file mode 100644 index 000000000..fa3ad0a25 --- /dev/null +++ b/.github/workflows/issue-close-comment.yml @@ -0,0 +1,31 @@ +name: Comment on Issue Close + +on: + issues: + types: [closed] + +permissions: + issues: write + +jobs: + greet-on-close: + runs-on: ubuntu-latest + + steps: + - name: Greet User + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issue = context.payload.issue; + const issueCreator = issue.user.login; + const issueNumber = issue.number; + + const greetingMessage = `Hello @${issueCreator}! Your issue #${issueNumber} has been closed. Thank you for your contribution!! 🙌`; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: greetingMessage + });