Free AI web copilot to create summaries, insights and extended knowledge, download it at here
2032
Abstract
have one. Click on the dots beside the team name and choose <code>Add Channel</code>.</p><figure id="c7c4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*6UCXhmzF_xWmDD5ks9dQow.png"><figcaption>Add a new channel in Teams</figcaption></figure><p id="fc89">To add a Webhook, click on the dots beside the channel and click on <code>Connectors</code> .</p><figure id="ec15"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*tPlvvbOhxYeStQn8UUtRtQ.png"><figcaption>Add a Webhook</figcaption></figure><p id="5d4d">Configure an <code>Incoming Webhook</code>. Teams shows the Webhook URL once you click <code>Create</code>. Copy this URL in the next step.</p><figure id="e3ae"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*qezH6S6c1mgzAgUg6CView.png"><figcaption>Configure a Webhook</figcaption></figure><h2 id="8dd6">Connect GitHub Actions and Teams</h2><p id="bf45">Open the repository which should notify you on failed builds. Go to <code>Settings</code> and then to <code>Secrets</code> . Add a secret for <code>Actions</code> with the name <code>TEAMS_WEBHOOK</code>.</p><figure id="88e1"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*vR1JT9xuJQPr5iSNaouCnQ.png"><figcaption></figcaption></figure><h2 id="e5f7">Add the notification step to your workflow</h2><p id="2626">Open your <code>workflow.yml</code> and add the following step:</p>
<figure id="8380">
<div>
<div>
<iframe class="gist-iframe" src="/gist/ablx/ee5699b5e3421d4d9645891735db3e6e.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="d0ff">This step only runs if the pipeline failed before. It creates the payload for the Teams Webhook and executes a POST request.</p><p id="2bbd">You will get a notification in Teams for the next broken build:</p><figure id="9f56"><img src="https://cdn-images-1.readmedium.c
Options
om/v2/resize:fit:800/1*0jxPfhiUqs0xKJ1OmWMHeA.png"><figcaption>Notification for a failed build.</figcaption></figure><p id="d8e5">You can click on the button to open GitHub and see the broken pipeline. <b>That’s it! Now you can react faster to broken pipelines!</b></p><h2 id="1c84">Bonus: Teams payload in detail</h2><p id="f17b">Let’s inspect the payload:</p>
<figure id="9228">
<div>
<div>
<iframe class="gist-iframe" src="/gist/ablx/75dae9dc6df1701cfca4d0800602222e.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="fc12">Notice that we used <i>GitHub Actions environment variables</i> to add useful content to the message. You can see all available variables in the <a href="https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables">official documentation</a>.</p><p id="da33">The <code>themeColor</code> field handles the red bar in the notification. See the <a href="https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL">Webhook documentation</a> for more fields and examples.</p><p id="1d91">Want to get more out of Teams? Check out the following article:</p><div id="4f67" class="link-block">
<a href="https://readmedium.com/react-faster-alertmanager-to-teams-fa888bcd7c01">
<div>
<div>
<h2>How Alertmanager and Teams easily reduce incident response time proactive</h2>
<div><h3>Get notifications from the Alertmanager to Microsoft Teams</h3></div>
<div><p>medium.com</p></div>
</div>
<div>
<div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*kS9AnQKD5KRN7LHETv9MkQ.png)"></div>
</div>
</div>
</a>
</div></article></body>