MCPcopy Create free account
hub / github.com/cli/cli / IssueFeatures

Method IssueFeatures

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

Source from the content-addressed store, hash-verified

195}
196
197func (d *detector) IssueFeatures() (IssueFeatures, error) {
198 if !ghauth.IsEnterprise(d.host) {
199 return allIssueFeatures, nil
200 }
201
202 features := IssueFeatures{
203 ApiActorsSupported: false, // TODO ApiActorsSupported - actor-based mutations unavailable on GHES
204 }
205
206 // Detect issue relationship support (GHES 3.19+) via schema introspection.
207 // Issue types and sub-issues are GA on all supported GHES versions (3.17+)
208 // and do not need detection.
209 var featureDetection struct {
210 Issue struct {
211 Fields []struct {
212 Name string
213 } `graphql:"fields(includeDeprecated: true)"`
214 } `graphql:"Issue: __type(name: \"Issue\")"`
215 }
216
217 gql := api.NewClientFromHTTP(d.httpClient)
218 err := gql.Query(d.host, "Issue_fields", &featureDetection, nil)
219 if err != nil {
220 return IssueFeatures{}, err
221 }
222
223 for _, field := range featureDetection.Issue.Fields {
224 if field.Name == "blockedBy" {
225 features.IssueRelationshipsSupported = true
226 break
227 }
228 }
229
230 return features, nil
231}
232
233func (d *detector) PullRequestFeatures() (PullRequestFeatures, error) {
234 // 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