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

Method IssueFeatures

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

Source from the content-addressed store, hash-verified

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