diff --git a/internal/featuredetection/feature_detection.go b/internal/featuredetection/feature_detection.go index 45800a8d7..5e6430f09 100644 --- a/internal/featuredetection/feature_detection.go +++ b/internal/featuredetection/feature_detection.go @@ -72,9 +72,12 @@ func (d *detector) IssueFeatures() (IssueFeatures, error) { } func (d *detector) PullRequestFeatures() (PullRequestFeatures, error) { - if !ghinstance.IsEnterprise(d.host) { - return allPullRequestFeatures, nil - } + // TODO: reinstate the short-circuit once the APIs are fully available on github.com + // https://github.com/cli/cli/issues/5778 + // + // if !ghinstance.IsEnterprise(d.host) { + // return allPullRequestFeatures, nil + // } features := PullRequestFeatures{ ReviewDecision: true, diff --git a/internal/featuredetection/feature_detection_test.go b/internal/featuredetection/feature_detection_test.go index ae8695482..261a099f4 100644 --- a/internal/featuredetection/feature_detection_test.go +++ b/internal/featuredetection/feature_detection_test.go @@ -20,6 +20,14 @@ func TestPullRequestFeatures(t *testing.T) { { name: "github.com", hostname: "github.com", + queryResponse: map[string]string{ + `query PullRequest_fields\b`: heredoc.Doc(` + { "data": { "PullRequest": { "fields": [ + {"name": "isInMergeQueue"}, + {"name": "isMergeQueueEnabled"} + ] } } } + `), + }, wantFeatures: PullRequestFeatures{ ReviewDecision: true, StatusCheckRollup: true, @@ -28,6 +36,23 @@ func TestPullRequestFeatures(t *testing.T) { }, wantErr: false, }, + { + name: "github.com with no merge queue", + hostname: "github.com", + queryResponse: map[string]string{ + `query PullRequest_fields\b`: heredoc.Doc(` + { "data": { "PullRequest": { "fields": [ + ] } } } + `), + }, + wantFeatures: PullRequestFeatures{ + ReviewDecision: true, + StatusCheckRollup: true, + BranchProtectionRule: true, + MergeQueue: false, + }, + wantErr: false, + }, { name: "GHE", hostname: "git.my.org",