Fix variant analysis monitor failing
All fields in the variant analysis skipped repositories are optional, but this was not properly defined in the API types. This will correct the types and the functions processing the data such that they handle non-existing fields.
This commit is contained in:
@@ -76,8 +76,8 @@ export interface VariantAnalysisRepoTask {
|
||||
}
|
||||
|
||||
export interface VariantAnalysisSkippedRepositories {
|
||||
access_mismatch_repos: VariantAnalysisSkippedRepositoryGroup,
|
||||
not_found_repo_nwos: VariantAnalysisNotFoundRepositoryGroup,
|
||||
no_codeql_db_repos: VariantAnalysisSkippedRepositoryGroup,
|
||||
over_limit_repos: VariantAnalysisSkippedRepositoryGroup
|
||||
access_mismatch_repos?: VariantAnalysisSkippedRepositoryGroup,
|
||||
not_found_repo_nwos?: VariantAnalysisNotFoundRepositoryGroup,
|
||||
no_codeql_db_repos?: VariantAnalysisSkippedRepositoryGroup,
|
||||
over_limit_repos?: VariantAnalysisSkippedRepositoryGroup
|
||||
}
|
||||
|
||||
@@ -100,7 +100,11 @@ function processSkippedRepositories(
|
||||
};
|
||||
}
|
||||
|
||||
function processRepoGroup(repoGroup: ApiVariantAnalysisSkippedRepositoryGroup): VariantAnalysisSkippedRepositoryGroup {
|
||||
function processRepoGroup(repoGroup: ApiVariantAnalysisSkippedRepositoryGroup | undefined): VariantAnalysisSkippedRepositoryGroup | undefined {
|
||||
if (!repoGroup) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const repos = repoGroup.repositories.map(repo => {
|
||||
return {
|
||||
id: repo.id,
|
||||
@@ -114,7 +118,11 @@ function processRepoGroup(repoGroup: ApiVariantAnalysisSkippedRepositoryGroup):
|
||||
};
|
||||
}
|
||||
|
||||
function processNotFoundRepoGroup(repoGroup: ApiVariantAnalysisNotFoundRepositoryGroup): VariantAnalysisSkippedRepositoryGroup {
|
||||
function processNotFoundRepoGroup(repoGroup: ApiVariantAnalysisNotFoundRepositoryGroup | undefined): VariantAnalysisSkippedRepositoryGroup | undefined {
|
||||
if (!repoGroup) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const repo_full_names = repoGroup.repository_full_names.map(nwo => {
|
||||
return {
|
||||
fullName: nwo
|
||||
|
||||
@@ -46,25 +46,25 @@ describe('Variant Analysis processor', function() {
|
||||
'accessMismatchRepos': {
|
||||
'repositories': [
|
||||
{
|
||||
'fullName': access_mismatch_repos.repositories[0].full_name,
|
||||
'id': access_mismatch_repos.repositories[0].id
|
||||
'fullName': access_mismatch_repos?.repositories[0].full_name,
|
||||
'id': access_mismatch_repos?.repositories[0].id
|
||||
},
|
||||
{
|
||||
'fullName': access_mismatch_repos.repositories[1].full_name,
|
||||
'id': access_mismatch_repos.repositories[1].id
|
||||
'fullName': access_mismatch_repos?.repositories[1].full_name,
|
||||
'id': access_mismatch_repos?.repositories[1].id
|
||||
}
|
||||
],
|
||||
'repositoryCount': access_mismatch_repos.repository_count
|
||||
'repositoryCount': access_mismatch_repos?.repository_count
|
||||
},
|
||||
'noCodeqlDbRepos': {
|
||||
'repositories': [
|
||||
{
|
||||
'fullName': no_codeql_db_repos.repositories[0].full_name,
|
||||
'id': no_codeql_db_repos.repositories[0].id
|
||||
'fullName': no_codeql_db_repos?.repositories[0].full_name,
|
||||
'id': no_codeql_db_repos?.repositories[0].id
|
||||
},
|
||||
{
|
||||
'fullName': no_codeql_db_repos.repositories[1].full_name,
|
||||
'id': no_codeql_db_repos.repositories[1].id,
|
||||
'fullName': no_codeql_db_repos?.repositories[1].full_name,
|
||||
'id': no_codeql_db_repos?.repositories[1].id,
|
||||
}
|
||||
],
|
||||
'repositoryCount': 2
|
||||
@@ -72,26 +72,26 @@ describe('Variant Analysis processor', function() {
|
||||
'notFoundRepos': {
|
||||
'repositories': [
|
||||
{
|
||||
'fullName': not_found_repo_nwos.repository_full_names[0]
|
||||
'fullName': not_found_repo_nwos?.repository_full_names[0]
|
||||
},
|
||||
{
|
||||
'fullName': not_found_repo_nwos.repository_full_names[1]
|
||||
'fullName': not_found_repo_nwos?.repository_full_names[1]
|
||||
}
|
||||
],
|
||||
'repositoryCount': not_found_repo_nwos.repository_count
|
||||
'repositoryCount': not_found_repo_nwos?.repository_count
|
||||
},
|
||||
'overLimitRepos': {
|
||||
'repositories': [
|
||||
{
|
||||
'fullName': over_limit_repos.repositories[0].full_name,
|
||||
'id': over_limit_repos.repositories[0].id
|
||||
'fullName': over_limit_repos?.repositories[0].full_name,
|
||||
'id': over_limit_repos?.repositories[0].id
|
||||
},
|
||||
{
|
||||
'fullName': over_limit_repos.repositories[1].full_name,
|
||||
'id': over_limit_repos.repositories[1].id
|
||||
'fullName': over_limit_repos?.repositories[1].full_name,
|
||||
'id': over_limit_repos?.repositories[1].id
|
||||
}
|
||||
],
|
||||
'repositoryCount': over_limit_repos.repository_count
|
||||
'repositoryCount': over_limit_repos?.repository_count
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user