private static void Run(GitHubFlowArguments arguments, string workingDirectory)
        {
            var fallbackStrategy = new LocalBuild();
            var buildServers = new IBuildServer[] {new TeamCity()};
            var currentBuildServer = buildServers.FirstOrDefault(s => s.IsRunningInBuildAgent()) ?? fallbackStrategy;

            var gitDirectory = GitDirFinder.TreeWalkForGitDir(workingDirectory);
            if (string.IsNullOrEmpty(gitDirectory))
            {
                if (currentBuildServer.IsRunningInBuildAgent()) //fail the build if we're on a TC build agent
                {
                    // This exception might have to change when more build servers are added
                    throw new Exception("Failed to find .git directory on agent. " +
                                        "Please make sure agent checkout mode is enabled for you VCS roots - " +
                                        "http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode");
                }

                throw new Exception("Failed to find .git directory.");
            }

            Console.WriteLine("Git directory found at {0}", gitDirectory);
            var repositoryRoot = Directory.GetParent(gitDirectory).FullName;

            var gitHelper = new GitHelper();
            var gitRepo = new Repository(gitDirectory);
            var lastTaggedReleaseFinder = new LastTaggedReleaseFinder(gitRepo, gitHelper);
            var nextSemverCalculator = new NextSemverCalculator(new NextVersionTxtFileFinder(repositoryRoot),
                lastTaggedReleaseFinder);
            var buildNumberCalculator = new BuildNumberCalculator(nextSemverCalculator, lastTaggedReleaseFinder, gitHelper,
                gitRepo, currentBuildServer);

            var nextBuildNumber = buildNumberCalculator.GetBuildNumber();
            WriteResults(arguments, nextBuildNumber, currentBuildServer);
        }
        private static void Run(GitHubFlowVersionContext context)
        {
            var gitHelper = new GitHelper();
            var gitRepo   = new Repository(context.GitDirectory);
            var lastTaggedReleaseFinder = new LastTaggedReleaseFinder(gitRepo, gitHelper, context.WorkingDirectory);
            var nextSemverCalculator    = new NextSemverCalculator(new NextVersionTxtFileFinder(context.RepositoryRoot),
                                                                   lastTaggedReleaseFinder);
            var buildNumberCalculator = new BuildNumberCalculator(nextSemverCalculator, lastTaggedReleaseFinder, gitHelper,
                                                                  gitRepo, context.CurrentBuildServer);

            context.NextBuildNumber = buildNumberCalculator.GetBuildNumber();

            var variableProvider = new VariableProvider();

            context.Variables = variableProvider.GetVariables(context.NextBuildNumber);
            WriteResults(context);
        }