Skip to content

4IP/slack-notif-review

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork from this repository: kv109

Maintained by Arief JR

ReadyForReview - Slack Notifier

ReadyForReview notifies you

  • when a pull request is ready for review (i.e. when a non-draft PR is opened or a draft PR is ready for review),
  • when a pull request is accepted and
  • when a pull request is rejected.

image

Setup

  1. Generate your Slack webhook. You can do it here.
  2. Add created webhook as a secret named SLACK_WEBHOOK using GitHub Action's Secret. See your project Settings -> Secrets.
  3. Create .github/workflows/main.yml and put there content like the ones from examples.

Don't forget about enabling local and third party actions for your repository in your project Settings -> Actions!

Example usage

on: 
  pull_request:
    types: [opened, ready_for_review]
  pull_request_review:
    types: [submitted]
name: Notify about PR ready for review
jobs:
  slackNotification:
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Slack Notification
      uses: 4IP/[email protected]
      env:
        SLACK_CHANNEL: your-slack-channel           # required
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} # required
on: 
  pull_request:
    types: [opened, ready_for_review]
  pull_request_review:
    types: [submitted]
name: Notify about PR ready for review
jobs:
  slackNotification:
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Slack Notification
      uses: 4IP/[email protected]
      env:
        IGNORE_DRAFTS: false # Ignore draft pull requests. Default: true.
        PR_APPROVED_FORMAT: | # Format is fully customizable.
          *{ pull_request.title }* was approved by { review.user.login } :heavy_check_mark:
        PR_READY_FOR_REVIEW_FORMAT: |
          New PR! :smile:
          Title: *{ pull_request.title }*
          Author: { pull_request.user.login }
          URL: { pull_request.html_url }
        PR_REJECTED_FORMAT: |
          *{ pull_request.title }* was rejected by { review.user.login } :cry:
        SLACK_CHANNEL: your-slack-channel
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        USERNAME: Your username

Or if you want add workflows when reviewer is commented

on:
  pull_request:
    types: [ opened, synchronize, ready_for_review ]
    branches: [ master, develop ]
  pull_request_review:
    types: [ submitted ]

jobs:
  notify:
    if: ${{ !github.event.pull_request.draft }}
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
      - uses: 4IP/[email protected]
        env:
          IGNORE_DRAFTS: false # Ignore draft pull requests. Default: true.
          PR_APPROVED_FORMAT: | # Format is fully customizable.
            *{ pull_request.title }* was approved by { review.user.login } at PR { pull_request.html_url } :white_check_mark:
          PR_READY_FOR_REVIEW_FORMAT: |
            <!here> please review, Jamtangancom-web PR!!! :rocket: :sungkem:
            Title: *{ pull_request.title }*
            Author: { pull_request.user.login }
            URL: { pull_request.html_url }
          PR_COMMENTED_FORMAT: |
            *{ pull_request.title }* was commented by { review.user.login } at PR { pull_request.html_url } :writing_hand:
          PR_REJECTED_FORMAT: |
            *{ pull_request.title }* was rejected by { review.user.login } :cry:
          SLACK_CHANNEL: your-slack-channel
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          USERNAME: Your username

Formatting

Any string inside brackets is replaced with a value taken from an actual event payload. All available values can be found here and here.

About

slack notification for review when pull request

Resources

Stars

Watchers

Forks

Packages

No packages published