generated from jacobtomlinson/python-container-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (20 loc) · 883 Bytes
/
main.py
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
import os
import requests # noqa We are just importing this to prove the dependency installed correctly
import pymsteams
import json
def main():
my_input = json.loads(os.environ["INPUT_RELEASEPAYLOAD"])
print(my_input)
myTeamsMessage = pymsteams.connectorcard(os.environ["INPUT_TEAMSWEBHOOK"])
myTeamsMessage.title("Release notes for version " + str(my_input['release']['tag_name']) +" of repository: " + str(my_input['repository']['name']))
# create the section
myMessageSection = pymsteams.cardsection()
# Section Title
myMessageSection.title(str(my_input['release']['name']))
# Section Text
myMessageSection.text(str(my_input['release']['body']))
# Add your section to the connector card object before sending
myTeamsMessage.addSection(myMessageSection)
myTeamsMessage.send()
if __name__ == "__main__":
main()