ci: enable Teams mentions for burgerdev (#3422)

* Enable Teams mentions for burgerdev
* Add instructions on how to update notify_teams assignees

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2024-10-16 10:54:53 +02:00 committed by GitHub
parent e27d80fa02
commit dd73c4ce5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

27
.github/actions/notify_teams/README.md vendored Normal file
View File

@ -0,0 +1,27 @@
# notify Teams action
This action is used to send a message to our Teams channel in case of a failure in the CI/CD pipeline.
The action will automatically choose an engineer to assign to the issue and tag them in the message.
Engineers are identified by their GitHub username and bound to a Microsoft Teams ID in `.attachments[0].content.msteams.entities`.
To add a new engineer, add a new entry to the entity list in the format:
```json
{
"type": "mention",
"text": "${github_username}",
"mentioned": {
"id": "${msteams_id}",
"name": "${name}"
}
}
```
Where `${github_username}` is the GitHub username of the engineer, `${msteams_id}` is the Microsoft Teams ID of the engineer, and `${name}` is the name of the engineer.
To find the Microsoft Teams ID use the following command:
```bash
az ad user show --id ${email} --query id
```
Where `${email}` is the email address of the engineer.

View File

@ -25,7 +25,7 @@ runs:
continue-on-error: true
shell: bash
run: |
cp .github/teams_payload_template.json teams_payload.json
cp .github/actions/notify_teams/teams_payload_template.json teams_payload.json
# Add workflow name to the notification
yq -oj -iP '.attachments[0].content.body[0].columns[1].items[0].text = "${{ inputs.title }}"' teams_payload.json

View File

@ -1,5 +1,5 @@
{
"type": "message",
"type": "AdaptiveCard",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
@ -58,6 +58,14 @@
"id": "a9a34611-9a38-4c00-a8a2-f87d94c2bf7d",
"name": "Otto Bittner"
}
},
{
"type": "mention",
"text": "<at>burgerdev</at>",
"mentioned": {
"id": "c9efc581-58ca-4da6-93ce-79f69f89deeb",
"name": "Markus Rudy"
}
}
]
},