()
| 64 | return headers |
| 65 | |
| 66 | def get_content(): |
| 67 | build_url = f'https://dev.azure.com/{repo_name}/_build/results?buildId={build_id}&view=results' |
| 68 | |
| 69 | # We use github author here because it's what we have access to. If the name sometimes |
| 70 | # changes, add any name it might be. Check the git log. |
| 71 | requested_for = sys.argv[1].rstrip() |
| 72 | # This is a map of team member github author names to opensource mattermost username |
| 73 | usernames_map = { |
| 74 | 'Will Greenberg': 'willg', |
| 75 | 'Erica Portnoy': 'erica', |
| 76 | 'Brad Warren': 'brad', |
| 77 | 'ohemorange': 'erica', |
| 78 | } |
| 79 | |
| 80 | if requested_for in usernames_map: |
| 81 | text_body = f'{get_greeting()} @{usernames_map[requested_for]}, {get_message()}\n{build_url}' |
| 82 | else: |
| 83 | text_body = (f"{get_greeting()} {requested_for}, {get_message()}\nIf you'd like to get @ mentioned for " |
| 84 | "releases you do in the future, please modify tools/notify_mattermost.py with your " |
| 85 | f"git author name.\n{build_url}") |
| 86 | |
| 87 | content = { |
| 88 | 'text': text_body, |
| 89 | } |
| 90 | return content |
| 91 | |
| 92 | response = requests.request( |
| 93 | method='POST', |
no test coverage detected