| 187 | } |
| 188 | |
| 189 | func (d *detector) IssueFeatures() (IssueFeatures, error) { |
| 190 | if !ghauth.IsEnterprise(d.host) { |
| 191 | return allIssueFeatures, nil |
| 192 | } |
| 193 | |
| 194 | features := IssueFeatures{ |
| 195 | ApiActorsSupported: false, // TODO ApiActorsSupported - actor-based mutations unavailable on GHES |
| 196 | } |
| 197 | |
| 198 | // Detect issue relationship support (GHES 3.19+) via schema introspection. |
| 199 | // Issue types and sub-issues are GA on all supported GHES versions (3.17+) |
| 200 | // and do not need detection. |
| 201 | var featureDetection struct { |
| 202 | Issue struct { |
| 203 | Fields []struct { |
| 204 | Name string |
| 205 | } `graphql:"fields(includeDeprecated: true)"` |
| 206 | } `graphql:"Issue: __type(name: \"Issue\")"` |
| 207 | } |
| 208 | |
| 209 | gql := api.NewClientFromHTTP(d.httpClient) |
| 210 | err := gql.Query(d.host, "Issue_fields", &featureDetection, nil) |
| 211 | if err != nil { |
| 212 | return IssueFeatures{}, err |
| 213 | } |
| 214 | |
| 215 | for _, field := range featureDetection.Issue.Fields { |
| 216 | if field.Name == "blockedBy" { |
| 217 | features.IssueRelationshipsSupported = true |
| 218 | break |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | return features, nil |
| 223 | } |
| 224 | |
| 225 | func (d *detector) PullRequestFeatures() (PullRequestFeatures, error) { |
| 226 | // TODO: reinstate the short-circuit once the APIs are fully available on github.com |