"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "api/queries_pr.go" between
gh-cli-1.11.0.tar.gz and gh-cli-1.12.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

queries_pr.go  (gh-cli-1.11.0):queries_pr.go  (gh-cli-1.12.0)
skipping to change at line 399 skipping to change at line 399
ReviewRequested edges ReviewRequested edges
} }
var fragments string var fragments string
if len(options.Fields) > 0 { if len(options.Fields) > 0 {
fields := set.NewStringSet() fields := set.NewStringSet()
fields.AddValues(options.Fields) fields.AddValues(options.Fields)
// these are always necessary to find the PR for the current bran ch // these are always necessary to find the PR for the current bran ch
fields.AddValues([]string{"isCrossRepository", "headRepositoryOwn er", "headRefName"}) fields.AddValues([]string{"isCrossRepository", "headRepositoryOwn er", "headRefName"})
gr := PullRequestGraphQL(fields.ToSlice()) gr := PullRequestGraphQL(fields.ToSlice())
fragments = fmt.Sprintf("fragment pr on PullRequest{%[1]s}fragmen t prWithReviews on PullRequest{%[1]s}", gr) fragments = fmt.Sprintf("fragment pr on PullRequest{%s}fragment p rWithReviews on PullRequest{...pr}", gr)
} else { } else {
var err error var err error
fragments, err = pullRequestFragment(client.http, repo.RepoHost() ) fragments, err = pullRequestFragment(client.http, repo.RepoHost() )
if err != nil { if err != nil {
return nil, err return nil, err
} }
} }
queryPrefix := ` queryPrefix := `
query PullRequestStatus($owner: String!, $repo: String!, $headRefName: St ring!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) { query PullRequestStatus($owner: String!, $repo: String!, $headRefName: St ring!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
skipping to change at line 534 skipping to change at line 534
return &payload, nil return &payload, nil
} }
func pullRequestFragment(httpClient *http.Client, hostname string) (string, erro r) { func pullRequestFragment(httpClient *http.Client, hostname string) (string, erro r) {
cachedClient := NewCachedClient(httpClient, time.Hour*24) cachedClient := NewCachedClient(httpClient, time.Hour*24)
prFeatures, err := determinePullRequestFeatures(cachedClient, hostname) prFeatures, err := determinePullRequestFeatures(cachedClient, hostname)
if err != nil { if err != nil {
return "", err return "", err
} }
var reviewsFragment string fields := []string{
if prFeatures.HasReviewDecision { "number", "title", "state", "url", "isDraft", "isCrossRepository"
reviewsFragment = "reviewDecision" ,
"requiresStrictStatusChecks", "headRefName", "headRepositoryOwner
", "mergeStateStatus",
} }
var statusesFragment string
if prFeatures.HasStatusCheckRollup { if prFeatures.HasStatusCheckRollup {
statusesFragment = ` fields = append(fields, "statusCheckRollup")
commits(last: 1) {
nodes {
commit {
statusCheckRollup {
contexts(last: 100) {
nodes {
...on StatusConte
xt {
state
}
...on CheckRun {
conclusio
n
status
}
}
}
}
}
}
}
`
} }
var requiresStrictStatusChecks string var reviewFields []string
if prFeatures.HasBranchProtectionRule { if prFeatures.HasReviewDecision {
requiresStrictStatusChecks = ` reviewFields = append(reviewFields, "reviewDecision")
baseRef {
branchProtectionRule {
requiresStrictStatusChecks
}
}`
} }
fragments := fmt.Sprintf(` fragments := fmt.Sprintf(`
fragment pr on PullRequest { fragment pr on PullRequest {%s}
number fragment prWithReviews on PullRequest {...pr,%s}
title `, PullRequestGraphQL(fields), PullRequestGraphQL(reviewFields))
state
url
headRefName
mergeStateStatus
headRepositoryOwner {
login
}
%s
isCrossRepository
isDraft
%s
}
fragment prWithReviews on PullRequest {
...pr
%s
}
`, requiresStrictStatusChecks, statusesFragment, reviewsFragment)
return fragments, nil return fragments, nil
} }
// CreatePullRequest creates a pull request in a GitHub repository // CreatePullRequest creates a pull request in a GitHub repository
func CreatePullRequest(client *Client, repo *Repository, params map[string]inter face{}) (*PullRequest, error) { func CreatePullRequest(client *Client, repo *Repository, params map[string]inter face{}) (*PullRequest, error) {
query := ` query := `
mutation PullRequestCreate($input: CreatePullRequestInput!) { mutation PullRequestCreate($input: CreatePullRequestInput!) {
createPullRequest(input: $input) { createPullRequest(input: $input) {
pullRequest { pullRequest {
id id
 End of changes. 6 change blocks. 
57 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)