| 226 | } |
| 227 | |
| 228 | func (d *detector) IssueFeatures() (IssueFeatures, error) { |
| 229 | if !ghauth.IsEnterprise(d.host) { |
| 230 | return allIssueFeatures, nil |
| 231 | } |
| 232 | |
| 233 | features := IssueFeatures{ |
| 234 | ApiActorsSupported: false, // TODO ApiActorsSupported - actor-based mutations unavailable on GHES |
| 235 | } |
| 236 | |
| 237 | // Detect issue relationship support (GHES 3.19+) via schema introspection. |
| 238 | // Issue types and sub-issues are GA on all supported GHES versions (3.17+) |
| 239 | // and do not need detection. |
| 240 | var featureDetection struct { |
| 241 | Issue struct { |
| 242 | Fields []struct { |
| 243 | Name string |
| 244 | } `graphql:"fields(includeDeprecated: true)"` |
| 245 | } `graphql:"Issue: __type(name: \"Issue\")"` |
| 246 | } |
| 247 | |
| 248 | gql := api.NewClientFromHTTP(d.client()) |
| 249 | err := gql.Query(d.host, "Issue_fields", &featureDetection, nil) |
| 250 | if err != nil { |
| 251 | return IssueFeatures{}, err |
| 252 | } |
| 253 | |
| 254 | for _, field := range featureDetection.Issue.Fields { |
| 255 | if field.Name == "blockedBy" { |
| 256 | features.IssueRelationshipsSupported = true |
| 257 | break |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | return features, nil |
| 262 | } |
| 263 | |
| 264 | func (d *detector) PullRequestFeatures() (PullRequestFeatures, error) { |
| 265 | // TODO: reinstate the short-circuit once the APIs are fully available on github.com |