Skip to content

Commit 9fab312

Browse files
authored
Initialize communication to MS Teams for new PR announcement
1 parent 026ad6e commit 9fab312

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Notify Teams on new PR
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
notify:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Post card to Microsoft Teams
12+
env:
13+
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
14+
run: |
15+
payload=$(cat <<'JSON'
16+
{
17+
"@type": "MessageCard",
18+
"@context": "http://schema.org/extensions",
19+
"summary": "Neuer Pull Request",
20+
"themeColor": "0076D7",
21+
"title": "Neuer PR: #${{ github.event.pull_request.number }} – ${{ github.event.pull_request.title }}",
22+
"sections": [{
23+
"activityTitle": "[${{ github.event.pull_request.user.login }}](${{ github.event.pull_request.user.html_url }}) hat einen Pull Request eröffnet",
24+
"facts": [
25+
{"name": "Repository", "value": "${{ github.repository }}"},
26+
{"name": "Branch", "value": "${{ github.event.pull_request.head.ref }} → ${{ github.event.pull_request.base.ref }}"},
27+
{"name": "Entwurf", "value": "${{ github.event.pull_request.draft }}"}
28+
],
29+
"markdown": true
30+
}],
31+
"potentialAction": [{
32+
"@type": "OpenUri",
33+
"name": "PR öffnen",
34+
"targets": [{"os": "default", "uri": "${{ github.event.pull_request.html_url }}"}]
35+
}]
36+
}
37+
JSON
38+
)
39+
curl -sS -X POST \
40+
-H "Content-Type: application/json" \
41+
-d "$payload" \
42+
"$TEAMS_WEBHOOK_URL"

0 commit comments

Comments
 (0)