Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pkg/github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,16 @@ func isUnsupportedIssueFieldValuesSchemaError(err error) bool {
}

message := strings.ToLower(err.Error())
isMissingFieldError := strings.Contains(message, "doesn't exist on type") ||
strings.Contains(message, "does not exist on type") ||
strings.Contains(message, "cannot query field") ||
strings.Contains(message, "is not defined on type")
mentionsIssueType := strings.Contains(message, "on type 'issue'") ||
strings.Contains(message, `on type "issue"`) ||
strings.Contains(message, "on type issue")
if strings.Contains(message, "issuefieldvalues") &&
mentionsIssueType &&
(strings.Contains(message, "doesn't exist on type") ||
strings.Contains(message, "does not exist on type") ||
strings.Contains(message, "cannot query field") ||
strings.Contains(message, "is not defined on type")) {
isMissingFieldError {
return true
}

Expand All @@ -763,6 +764,9 @@ func isUnsupportedIssueFieldValuesSchemaError(err error) bool {
if !strings.Contains(message, issueFieldType) {
continue
}
if strings.Contains(message, "fulldatabaseid") && isMissingFieldError {
return true
}
return strings.Contains(message, "unknown type") ||
strings.Contains(message, "isn't a defined type") ||
strings.Contains(message, "is not a defined type") ||
Expand Down
11 changes: 11 additions & 0 deletions pkg/github/issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,17 @@ func Test_SearchIssues_FieldValuesEnrichment(t *testing.T) {
gqlResponse: githubv4mock.ErrorResponse(`Fragment cannot be spread here as objects of type "IssueFieldValue" can never be of type "IssueFieldTextValue".`),
wantObservedGQLError: true,
},
{
name: "GHES 3.21 missing fullDatabaseId on IssueFieldDate",
gqlResponse: githubv4mock.ErrorResponse("Field 'fullDatabaseId' doesn't exist on type 'IssueFieldDate'"),
wantObservedGQLError: true,
},
{
name: "GHES 3.21 missing fullDatabaseId on IssueFieldText with double quotes",
gqlResponse: githubv4mock.ErrorResponse(`Cannot query field "fullDatabaseId" on type "IssueFieldText".`),
wantObservedGQLError: true,
useFieldsFilter: true,
},
{
name: "unrelated GraphQL validation error",
gqlResponse: githubv4mock.ErrorResponse("Field 'viewer' doesn't exist on type 'Query'"),
Expand Down