Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create code review and merge notifications to slack #401

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/label-notifications.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Label Notifications

on:
label:
types: [created, deleted]
pull_request:
types: [labeled]

jobs:
notify-slack-needs-review:
if: github.event_name == 'pull_request' && github.event.label.name == 'needs review'
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Pull Request Needs Review",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🔍 Pull Request Needs Review",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}>*"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Author:*\n${{ github.event.pull_request.user.login }}"
},
{
"type": "mrkdwn",
"text": "*Repository:*\n${{ github.repository }}"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Description:*\n${{ github.event.pull_request.body }}"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Added by: ${{ github.actor }} | Changes: +${{ github.event.pull_request.additions }} -${{ github.event.pull_request.deletions }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SLACK_CHANNEL: C084HM1MKDW
68 changes: 68 additions & 0 deletions .github/workflows/merged-pr-notifications.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Merged PR Notifications

on:
pull_request:
types: [closed]

jobs:
notify-slack-pr-merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Pull Request Merged",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🎉 Pull Request Merged",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}>*"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Author:*\n${{ github.event.pull_request.user.login }}"
},
{
"type": "mrkdwn",
"text": "*Repository:*\n${{ github.repository }}"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Description:*\n${{ github.event.pull_request.body }}"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Merged by: ${{ github.actor }} | Changes: +${{ github.event.pull_request.additions }} -${{ github.event.pull_request.deletions }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SLACK_CHANNEL: C084HM1MKDW
Loading