From 7b9eac6c25cd49a5c8923cd972fdd467ca83abe2 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Thu, 29 Dec 2016 22:00:03 +0000 Subject: [PATCH] guess branch name in appveyor --- build/Program.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build/Program.cs b/build/Program.cs index 95e91cecdc..75fc8974ee 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -71,6 +71,23 @@ namespace ConsoleApplication // lets build version friendly commit string branch = repo.Head.FriendlyName; + + // lets see if we are running in appveyor + var appveryorBranch = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH"); + if (!string.IsNullOrWhiteSpace(appveryorBranch)) + { + branch = appveryorBranch; + } + + var prNumber = Environment.GetEnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER"); + if (!string.IsNullOrWhiteSpace(prNumber)) + { + branch = "PR" + prNumber; + } + if(branch == "(no branch)") + { + throw new Exception("unable to find branch"); + } branch = branch.Replace("/", "-").Replace("--", "-"); if (branch == "master") {