Skip to content

Instantly share code, notes, and snippets.

@parjun8840
Created January 21, 2023 09:36
Show Gist options
  • Save parjun8840/93122c724e81feee891180f39d7c086a to your computer and use it in GitHub Desktop.
Save parjun8840/93122c724e81feee891180f39d7c086a to your computer and use it in GitHub Desktop.
slack notification for review process
#.github/workflows/slacknotification.yml
on:
pull_request:
types: [opened, reopened, synchronize]
name: notification-pr-open
jobs:
slack_msg_send:
if: github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# For posting a rich message using Block Kit
payload: |
{
"text": "A PR has been ${{ github.event.action }} :\n URL of the PR: ${{ github.event.pull_request.html_url }}, Target Branch- ${{ github.event.pull_request.base.ref }}\n PR Title- ${{ github.event.pull_request.title }}, Requested By: ${{ github.event.pull_request.user.login }}" }
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment