Ejemplo n.º 1
0
        public static BuildTargetResult CreatePR(BuildTargetContext c)
        {
            string remoteBranchName = c.GetRemoteBranchName();
            string commitMessage    = c.GetCommitMessage();

            NewPullRequest prInfo = new NewPullRequest(
                $"[{s_config.GitHubUpstreamBranch}] {commitMessage}",
                s_config.GitHubOriginOwner + ":" + remoteBranchName,
                s_config.GitHubUpstreamBranch);

            string[] prNotifications = s_config.GitHubPullRequestNotifications;
            if (prNotifications.Length > 0)
            {
                prInfo.Body = $"/cc @{string.Join(" @", prNotifications)}";
            }

            GitHubClient gitHub = new GitHubClient(new ProductHeaderValue("dotnetDependencyUpdater"));

            gitHub.Credentials = new Credentials(s_config.Password);

            PullRequest createdPR = gitHub.PullRequest.Create(s_config.GitHubUpstreamOwner, s_config.GitHubProject, prInfo).Result;

            c.Info($"Created Pull Request: {createdPR.HtmlUrl}");

            return(c.Success());
        }
Ejemplo n.º 2
0
        public static BuildTargetResult CreatePR(BuildTargetContext c)
        {
            string remoteBranchName = c.GetRemoteBranchName();

            NewPullRequest prInfo = new NewPullRequest(
                PullRequestTitle,
                s_config.GitHubOriginOwner + ":" + remoteBranchName,
                s_config.GitHubUpstreamBranch);

            GitHubClient gitHub = new GitHubClient(new ProductHeaderValue("dotnetDependencyUpdater"));

            gitHub.Credentials = new Credentials(s_config.Password);

            PullRequest createdPR = gitHub.PullRequest.Create(s_config.GitHubUpstreamOwner, s_config.GitHubProject, prInfo).Result;

            c.Info($"Created Pull Request: {createdPR.HtmlUrl}");

            return(c.Success());
        }