Skip to content

Instantly share code, notes, and snippets.

@lennybacon
Created August 3, 2017 08:11
Show Gist options
  • Save lennybacon/56d9aeea218ca85a767ba42118e5bd0e to your computer and use it in GitHub Desktop.
Save lennybacon/56d9aeea218ca85a767ba42118e5bd0e to your computer and use it in GitHub Desktop.
Tell if the branch is a pull request
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="TellIfBranchIsPullRequest" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BUILD_SOURCEBRANCH>refs/pull/1/merge</BUILD_SOURCEBRANCH>
<IsPullRequest Condition="$(BUILD_SOURCEBRANCH.IndexOf(`/pull/`)) != -1">true</IsPullRequest>
<IsPullRequest Condition="$(BUILD_SOURCEBRANCH.IndexOf(`/pull/`)) == -1">false</IsPullRequest>
</PropertyGroup>
<Target Name="TellIfBranchIsPullRequest">
<Message Text="$(IsPullRequest)" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment