From e0c0bff2bcc23408eb4395f3b40ac5e3670f5ba2 Mon Sep 17 00:00:00 2001 From: Aditya Gannavarapu Date: Tue, 30 Apr 2024 00:43:54 +0530 Subject: [PATCH] Add GH actions --- .github/workflows/slack_notification.yml | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/slack_notification.yml diff --git a/.github/workflows/slack_notification.yml b/.github/workflows/slack_notification.yml new file mode 100644 index 0000000..1b4dcf2 --- /dev/null +++ b/.github/workflows/slack_notification.yml @@ -0,0 +1,26 @@ +name: Slack Notification on PR Merge + +on: + pull_request: + types: + - closed + branches: + - 'github-workflow' + +jobs: + notify_on_merge: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Extract version from package.json + id: extract_version + run: echo ::set-output name=version::$(jq -r '.version' package.json) + + - name: Send message to Slack + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text": "Version: ${{ steps.extract_version.outputs.version }}\nPR ID: ${{ github.event.pull_request.number }}"}' $SLACK_WEBHOOK_URL