-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (44 loc) · 2.07 KB
/
pr-merge-notification.yml
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
44
45
46
47
48
name: Notify on PR Merge
on:
pull_request:
types:
- closed
jobs:
notify:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Send Slack Notification
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' \
--data '{
"text": "A PR has been merged in the repository *${{ github.repository }}*.\n*PR Title:* ${{ github.event.pull_request.title }}\n*Merged By:* ${{ github.event.pull_request.merged_by.login }}\n*PR URL:* ${{ github.event.pull_request.html_url }}"
}' $SLACK_WEBHOOK_URL
- name: Send Microsoft Teams Notification
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
run: |
curl -H 'Content-Type: application/json' -d '{
"@type": "MessageCard",
"@context": "https://schema.org/extensions",
"summary": "PR Merged in ${{ github.repository }}",
"themeColor": "FFA500",
"title": "Pull Request Merged",
"sections": [{
"activityTitle": "A PR has been merged in the repository *${{ github.repository }}*",
"activitySubtitle": "PR Title: ${{ github.event.pull_request.title }}",
"activityImage": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"facts": [{
"name": "Merged By",
"value": "${{ github.event.pull_request.merged_by.login }}"
},
{
"name": "PR URL",
"value": "[Link](${{ github.event.pull_request.html_url }})"
}
],
"markdown": true
}]
}' $TEAMS_WEBHOOK_URL