Skip to content

Commit df3d972

Browse files
committed
Refactor Teams notification step to send payload directly and enhance message content
1 parent f8d5ed3 commit df3d972

File tree

1 file changed

+92
-57
lines changed

1 file changed

+92
-57
lines changed

.github/workflows/release-notify.yml

Lines changed: 92 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -108,72 +108,107 @@ jobs:
108108
echo "formatted_jira_tickets=$formatted_jira_tickets" >> $GITHUB_OUTPUT
109109
110110

111-
- name: Prepare Teams notification payload
112-
id: prepare_teams_payload
113-
run: |
114-
payload=$(cat << 'EOF'
115-
{
116-
"type": "message",
117-
"attachments": [
118-
{
119-
"contentType": "application/vnd.microsoft.card.adaptive",
120-
"content": {
121-
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
122-
"type": "AdaptiveCard",
123-
"version": "1.4",
124-
"msteams": {
125-
"width": "Full"
126-
},
127-
"body": [
128-
{
129-
"type": "TextBlock",
130-
"text": "New Release: **${{ inputs.product_name }} - ${{ inputs.release_version }}**",
131-
"weight": "Bolder",
132-
"size": "Medium"
133-
},
134-
{
135-
"type": "FactSet",
136-
"facts": [
137-
{ "title": "Product:", "value": "${{ inputs.product_name }}" },
138-
{ "title": "Version:", "value": "${{ inputs.release_version }}" },
139-
{ "title": "CLI Version:", "value": "${{ inputs.cli_release_version }}" },
140-
{ "title": "Contributors:", "value": "${{ steps.extract_contributors.outputs.formatted_contributors }}" }
141-
]
142-
},
143-
{
144-
"type": "TextBlock",
145-
"text": ${{ steps.sanitize_release_notes.outputs.sanitized_release_notes }},
146-
"wrap": true
147-
}
148-
],
149-
"actions": [
150-
{
151-
"type": "Action.OpenUrl",
152-
"title": "View Release",
153-
"url": "${{ inputs.release_url }}"
154-
}
155-
]
156-
}
157-
}
158-
]
159-
}
160-
EOF
161-
)
162-
echo "teams_payload<<EOF" >> $GITHUB_OUTPUT
163-
echo "$payload" >> $GITHUB_OUTPUT
164-
echo "EOF" >> $GITHUB_OUTPUT
165-
166111
# - name: Send notification to Teams
167112
# uses: Skitionek/notify-microsoft-teams@v1.0.8
168113
# with:
169114
# webhook_url: ${{ secrets.MS_TEAMS_WEBHOOK_URL }}
170-
# raw: ${{ steps.prepare_teams_payload.outputs.teams_payload }}
115+
# raw: >
116+
# {
117+
# "type": "message",
118+
# "attachments": [
119+
# {
120+
# "contentType": "application/vnd.microsoft.card.adaptive",
121+
# "content": {
122+
# "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
123+
# "type": "AdaptiveCard",
124+
# "version": "1.4",
125+
# "msteams": {
126+
# "width": "Full"
127+
# },
128+
# "body": [
129+
# {
130+
# "type": "TextBlock",
131+
# "text": "New Release: **${{ inputs.product_name }} - ${{ inputs.release_version }}**",
132+
# "weight": "Bolder",
133+
# "size": "Medium"
134+
# },
135+
# {
136+
# "type": "FactSet",
137+
# "facts": [
138+
# { "title": "Product:", "value": "${{ inputs.product_name }}" },
139+
# { "title": "Version:", "value": "${{ inputs.release_version }}" },
140+
# { "title": "CLI Version:", "value": "${{ inputs.cli_release_version }}" },
141+
# { "title": "Contributors:", "value": "${{ steps.extract_contributors.outputs.formatted_contributors }}" }
142+
# ]
143+
# },
144+
# {
145+
# "type": "TextBlock",
146+
# "text": ${{ steps.sanitize_release_notes.outputs.sanitized_release_notes }},
147+
# "wrap": true
148+
# }
149+
# ],
150+
# "actions": [
151+
# {
152+
# "type": "Action.OpenUrl",
153+
# "title": "View Release",
154+
# "url": "${{ inputs.release_url }}"
155+
# }
156+
# ]
157+
# }
158+
# }
159+
# ]
160+
# }
171161

172162
- name: Send notification to Teams (SYPHER TEAM)
173163
uses: Skitionek/notify-microsoft-teams@v1.0.8
174164
with:
175165
webhook_url: ${{ secrets.MS_TEAMS_WEBHOOK_URL_SYPHER }}
176-
raw: ${{ steps.prepare_teams_payload.outputs.teams_payload }}
166+
raw: >
167+
{
168+
"type": "message",
169+
"attachments": [
170+
{
171+
"contentType": "application/vnd.microsoft.card.adaptive",
172+
"content": {
173+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
174+
"type": "AdaptiveCard",
175+
"version": "1.4",
176+
"msteams": {
177+
"width": "Full"
178+
},
179+
"body": [
180+
{
181+
"type": "TextBlock",
182+
"text": "New Release: **${{ inputs.product_name }} - ${{ inputs.release_version }}**",
183+
"weight": "Bolder",
184+
"size": "Medium"
185+
},
186+
{
187+
"type": "FactSet",
188+
"facts": [
189+
{ "title": "Product:", "value": "${{ inputs.product_name }}" },
190+
{ "title": "Version:", "value": "${{ inputs.release_version }}" },
191+
{ "title": "CLI Version:", "value": "${{ inputs.cli_release_version }}" },
192+
{ "title": "Contributors:", "value": "${{ steps.extract_contributors.outputs.formatted_contributors }}" }
193+
]
194+
},
195+
{
196+
"type": "TextBlock",
197+
"text": ${{ steps.sanitize_release_notes.outputs.sanitized_release_notes }},
198+
"wrap": true
199+
}
200+
],
201+
"actions": [
202+
{
203+
"type": "Action.OpenUrl",
204+
"title": "View Release",
205+
"url": "${{ inputs.release_url }}"
206+
}
207+
]
208+
}
209+
}
210+
]
211+
}
177212
178213
- name: Get Current Date
179214
id: current-date

0 commit comments

Comments
 (0)