Ejemplo n.º 1
0
 public static bool TryGetPullRequestKey(Build build, out GitHubPullRequestKey prKey)
 {
     if (GetPullRequestKey(build) is { } k)
     {
         prKey = k;
         return(true);
     }
Ejemplo n.º 2
0
 public BuildInfo(
     BuildKey buildKey,
     BuildDefinitionInfo buildDefinitionInfo,
     GitHubPullRequestKey pullRequestKey,
     DateTime?startTime,
     DateTime?finishTime)
 {
     Key               = buildKey;
     DefinitionInfo    = buildDefinitionInfo;
     GitHubInfo        = new GitHubInfo(pullRequestKey.Organization, pullRequestKey.Repository);
     PullRequestNumber = pullRequestKey.Number;
     StartTime         = startTime;
     FinishTime        = finishTime;
 }
Ejemplo n.º 3
0
        public static bool TryGetPullRequestKey(Build build, out GitHubPullRequestKey prKey)
        {
            prKey = default;
            if (build.Reason != BuildReason.PullRequest)
            {
                return(false);
            }

            try
            {
                var items = build.SourceBranch.Split('/');
                if (int.TryParse(items[2], out int number) &&
                    GetGitHubInfo(build) is GitHubInfo gitHubInfo)
                {
                    prKey = new GitHubPullRequestKey(gitHubInfo.Organization, gitHubInfo.Repository, number);
                    return(true);
                }
            }
            catch
            {
            }

            return(false);
        }
Ejemplo n.º 4
0
 public RepositoryInfo(GitHubPullRequestKey prKey)
 {
     Id   = $"{prKey.Organization}/{prKey.Repository}";
     Type = GitHubTypeName;
 }