From 20e0cceb995e6322621cc2e496fecb42db8f0dbd Mon Sep 17 00:00:00 2001 From: Vijay Shanker Sharma Date: Wed, 19 Jun 2024 07:07:36 +0530 Subject: [PATCH] Added issue close greeting workflow --- .../workflows/auto-comment-issue-close.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/auto-comment-issue-close.yml diff --git a/.github/workflows/auto-comment-issue-close.yml b/.github/workflows/auto-comment-issue-close.yml new file mode 100644 index 0000000..982f899 --- /dev/null +++ b/.github/workflows/auto-comment-issue-close.yml @@ -0,0 +1,31 @@ +name: Comment on Issue Close + +on: + issues: + types: [closed] + +jobs: + greet-on-close: + permissions: + contents: read + issues: write + 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 + }); \ No newline at end of file