// gets the rest of merge data from one that was created from a tag or PR comment/body private static MergeData GetMergeData(this MergeData fromBody, WebhookPayload payload) { if (fromBody == null) { return(null); // silently fail } fromBody.RepositoryOwner = payload.Repository.Owner.Login; fromBody.RepositoryName = payload.Repository.Name; fromBody.PullRequestNumber = payload.PullRequest?.Number ?? payload.Issue?.Number ?? -1; fromBody.PullRequestAuthor = payload.PullRequest?.User?.Login; fromBody.MergeIssuer = payload.Sender?.Login; fromBody.InstallationId = payload.Installation?.Id ?? 0; return(fromBody); }
private static MergeData CheckPRHasCommand(WebhookPayload payload) { var body = payload?.PullRequest?.Body; if (body == null) { return(null); } var parser = MergeInfoParser.GetCommentParser(); var result = parser.Parse(body); result.RequesterAssociation = payload.PullRequest?.AuthorAssociation; return(result.GetMergeData(payload)); }