(client *Client, repo ghrepo.Interface, prNumber int, headRef string)
| 884 | } |
| 885 | |
| 886 | func ComparePullRequestBaseBranchWith(client *Client, repo ghrepo.Interface, prNumber int, headRef string) (*RefComparison, error) { |
| 887 | query := `query ComparePullRequestBaseBranchWith($owner: String!, $repo: String!, $pullRequestNumber: Int!, $headRef: String!) { |
| 888 | repository(owner: $owner, name: $repo) { |
| 889 | pullRequest(number: $pullRequestNumber) { |
| 890 | baseRef { |
| 891 | compare (headRef: $headRef) { |
| 892 | aheadBy, behindBy, status |
| 893 | } |
| 894 | } |
| 895 | } |
| 896 | } |
| 897 | }` |
| 898 | |
| 899 | var result struct { |
| 900 | Repository struct { |
| 901 | PullRequest struct { |
| 902 | BaseRef struct { |
| 903 | Compare RefComparison |
| 904 | } |
| 905 | } |
| 906 | } |
| 907 | } |
| 908 | variables := map[string]any{ |
| 909 | "owner": repo.RepoOwner(), |
| 910 | "repo": repo.RepoName(), |
| 911 | "pullRequestNumber": prNumber, |
| 912 | "headRef": headRef, |
| 913 | } |
| 914 | |
| 915 | if err := client.GraphQL(repo.RepoHost(), query, variables, &result); err != nil { |
| 916 | return nil, err |
| 917 | } |
| 918 | return &result.Repository.PullRequest.BaseRef.Compare, nil |
| 919 | } |
no test coverage detected