tag:help.appveyor.com,2012-11-13:/discussions/questions/35656-how-can-i-trigger-a-notification-only-when-a-branch-is-mergedAppVeyor: Discussion 2019-03-19T16:59:11Ztag:help.appveyor.com,2012-11-13:Comment/470833712019-03-18T19:27:15Z2019-03-18T19:27:15ZHow can I trigger a notification only when a branch is merged?<div><p>Hi Burke,</p>
<p>We have no option to filter notification by PR. But what you can do is instead of built-in notification write a simple script based on slack REST API (<a href="https://gist.github.com/IlyaFinkelshteyn/0796f738317dcb47ba62719d69e05c2c">sample</a>) and run it only if <code>APPVEYOR_PULL_REQUEST_TITLE</code> environment variable is not set <code>AND</code> <code>APPVEYOR_REPO_BRANCH</code> is <code>development</code>. Run it <code>on_finish</code></p>
<p>Something like this:</p>
<pre>
<code>on_finish:
- ps: if ((-not $env:APPVEYOR_PULL_REQUEST_TITLE) -and ($env:APPVEYOR_REPO_BRANCH -eq "development")) {.\notifySlack.ps1}</code>
</pre>
<p>For Slack notification script you can also use <a href="https://www.appveyor.com/docs/environment-variables/">environment variables</a>. And sure use <a href="https://www.appveyor.com/docs/build-configuration/#secure-variables">secure variable</a> for Slack token.</p>
<p>Ilya.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/470833712019-03-19T07:14:21Z2019-03-19T07:14:25ZHow can I trigger a notification only when a branch is merged?<div><p>Hi Ilya,<br>
This was very helpful. Thank you for your quick reply.</p>
<ul>
<li>Burke</li>
</ul></div>burke livingston