MCPcopy
hub / github.com/cli/cli / IssueFeatures

Method IssueFeatures

internal/featuredetection/feature_detection.go:165–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163}
164
165func (d *detector) IssueFeatures() (IssueFeatures, error) {
166 if !ghauth.IsEnterprise(d.host) {
167 return allIssueFeatures, nil
168 }
169
170 features := IssueFeatures{
171 ApiActorsSupported: false, // TODO ApiActorsSupported - actor-based mutations unavailable on GHES
172 }
173
174 // Detect issue relationship support (GHES 3.19+) via schema introspection.
175 // Issue types and sub-issues are GA on all supported GHES versions (3.17+)
176 // and do not need detection.
177 var featureDetection struct {
178 Issue struct {
179 Fields []struct {
180 Name string
181 } `graphql:"fields(includeDeprecated: true)"`
182 } `graphql:"Issue: __type(name: \"Issue\")"`
183 }
184
185 gql := api.NewClientFromHTTP(d.httpClient)
186 err := gql.Query(d.host, "Issue_fields", &featureDetection, nil)
187 if err != nil {
188 return IssueFeatures{}, err
189 }
190
191 for _, field := range featureDetection.Issue.Fields {
192 if field.Name == "blockedBy" {
193 features.IssueRelationshipsSupported = true
194 break
195 }
196 }
197
198 return features, nil
199}
200
201func (d *detector) PullRequestFeatures() (PullRequestFeatures, error) {
202 // TODO: reinstate the short-circuit once the APIs are fully available on github.com

Callers 1

TestIssueFeaturesFunction · 0.95

Calls 2

NewClientFromHTTPFunction · 0.92
QueryMethod · 0.65

Tested by 1

TestIssueFeaturesFunction · 0.76