Beispiel #1
0
            private static BuildInputHandler HandleGitInput(IPipelineRunManager pipelineRunManager, GitBuildInput git) => async cancellationToken => {
                var dir = pipelineRunManager.NextInputPath();

                Directory.CreateDirectory(dir);

                await GitUtil.CloneRepo(git.Url, dir, git.Branch);

                return(dir);
            };
Beispiel #2
0
            private async Task <string> HandleGitRepo(CancellationToken cancellationToken)
            {
                var config  = Config;
                var repoDir = Path.Combine(ProjectDir, "repo");

                if (!PathUtil.IsValidSubPath(config.Path))
                {
                    throw new Exception("Invalid project path.");
                }

                if (Directory.Exists(repoDir))
                {
                    Directory.Delete(repoDir, recursive: true);
                }
                await GitUtil.CloneRepo(config.Url, repoDir, config.Branch, depth : 1);

                return(await File.ReadAllTextAsync(Path.Combine(repoDir, config.Path), Encoding.UTF8, cancellationToken));
            }