From e2f4796d5aaff722c3a21fb32380a1302301b7f8 Mon Sep 17 00:00:00 2001 From: Sejal Date: Sat, 12 Oct 2024 19:26:01 +0530 Subject: [PATCH] Create auto-comment-on-close.yml --- .github/workflows/auto-comment-on-close.yml | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/auto-comment-on-close.yml diff --git a/.github/workflows/auto-comment-on-close.yml b/.github/workflows/auto-comment-on-close.yml new file mode 100644 index 0000000..fa878b6 --- /dev/null +++ b/.github/workflows/auto-comment-on-close.yml @@ -0,0 +1,29 @@ +name: Comment on Issue Close + +on: + issues: + types: [closed] + +jobs: + greet-on-close: + runs-on: ubuntu-latest + permissions: + issues: write + 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 + });