-
Notifications
You must be signed in to change notification settings - Fork 16
43 lines (39 loc) · 1.45 KB
/
gh-event-notification.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: GH Event Notification
on:
# issues:
# types: [opened]
# pull_request:
# types: [opened]
workflow_dispatch:
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Get PR or Issue details
id: details
run: |
if [ "${{ github.event_name }}" == "issues" ]; then
echo "::set-output name=type::issue"
echo "::set-output name=title::${{ github.event.issue.title }}"
echo "::set-output name=user::${{ github.event.issue.user.login }}"
echo "::set-output name=url::${{ github.event.issue.html_url }}"
else
echo "::set-output name=type::pull_request"
echo "::set-output name=title::${{ github.event.pull_request.title }}"
echo "::set-output name=user::${{ github.event.pull_request.user.login }}"
echo "::set-output name=url::${{ github.event.pull_request.html_url }}"
fi
echo "::set-output name=repo::${{ github.repository }}"
- name: Send notification to Slack
uses: slackapi/[email protected]
with:
payload: |
{
"type": "${{ steps.details.outputs.type }}",
"title": "${{ steps.details.outputs.title }}",
"user": "${{ steps.details.outputs.user }}",
"repo": "${{ steps.details.outputs.repo }}",
"url": "${{ steps.details.outputs.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GH_NOTIF_URL }}