SVNSlackNotifier is a lightweight, dependency-free .NET console app to send VisualSVN Server commit notifications to Slack.
- .NET Framework 4.5+ (uses
HttpClient) - If using the
-urlparameter, it currently expects the new HTML5 browser in VisualSVN Server 3.2.0+
- If you haven't already, add a new "Incoming WebHooks" integration in your Slack account.
- Copy the
.exeand.configfiles from the latest Release into a folder of your choosing that is accessible from your svn server. - Edit the
.configfile and replace the appSettings keySlackWebhookURLwith the Webhook URL found in your Slack integration setup.
To let SVNSlackNotifier know about commits, we need to edit the post-commit hook in your svn repo. For each repository you'd like notifying to Slack...
- Open VisualSVN Server Manager and right-click on the repository. Click Properties in the context menu.
- On the "Hooks" tab, highlight the "Post-commit hook" option and click "Edit".
- In the field, enter the path to your
SVNSlackNotifier.exeexecutable along with any parameters (see below) you would like. Parameters-pathand-revare required. The more parameters you provide, the better the output into Slack. An example might look like:
"C:\SVNSlackNotifier\SVNSlackNotifier.exe" -path=%1 -rev=%2 -name=TestRepo -url=http://scswinvm:8080/svn/TestRepo-path(required) - The physical path to the repository. This is provided by thepost-commithook as%1.-rev(required) - The revision number of the commit. This is provided by thepost-commithook as%2.-name(optional) - The name of the repository. If provided, the repo name will appear in the Slack notification.-url(optional) - The URL of the repository. If provided, the revision number will be linked to the commit page.-channel(optional) - The Slack channel in which to post the notification. If provided, this will override the choice in your Slack integration setup and post to this channel instead. Format must be#channelname(for channel) or@username(for a DM).
- A log file
SVNSlackNotifier.logwill be written to the executable's folder if any errors occur. Check there first to see what's up. - Ensure you have replaced the app setting
SlackWebhookURLin the.configfile with your actual URL given by Slack when you setup your integration. - Ensure that the
.configfile's app settingsvnlookPathis correct for your installation. The app usessvnlookto lookup more details about the commit such as the author name and commit message.
- Thanks to the guys at VisualSVN for permission to use their logo for this little integration.
