Skip to content

Commit 6dd36c9

Browse files
authored
Update Workflow to use correct webhook
1 parent 0fc356a commit 6dd36c9

1 file changed

Lines changed: 18 additions & 32 deletions

File tree

.github/workflows/main.yml

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,28 @@
1-
name: Notify Teams on new PR
1+
name: Send PR events to Power Automate
22

33
on:
4-
pull_request:
5-
types: [opened]
4+
pull_request_target:
5+
types: [opened, reopened, ready_for_review]
66

77
jobs:
8-
notify:
8+
notify-power-automate:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
1013
steps:
11-
- name: Post card to Microsoft Teams
14+
- name: Prepare and send PR event to Power Automate
1215
env:
13-
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
16+
FLOW_URL: ${{ secrets.FLOW_WEBHOOK_URL }}
1417
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": "Beschreibung", "value": "${{ github.event.pull_request.body }}"}
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-
)
18+
set -euo pipefail
19+
20+
echo "→ Sending pull_request event to Power Automate..."
3921
curl -sS -X POST \
4022
-H "Content-Type: application/json" \
41-
-d "$payload" \
42-
"$TEAMS_WEBHOOK_URL"
23+
-H "X-GitHub-Event: pull_request" \
24+
-H "X-Repository: $GITHUB_REPOSITORY" \
25+
--data-binary "@$GITHUB_EVENT_PATH" \
26+
"$FLOW_URL"
27+
28+
echo "✅ Event sent for PR #${{ github.event.number }} in ${{ github.repository }}"

0 commit comments

Comments
 (0)