Skip to content

Commit

Permalink
Fix octokit types (elastic#211643)
Browse files Browse the repository at this point in the history
Related to elastic#211450

(cherry picked from commit 8a55fdf)
  • Loading branch information
jbudz committed Feb 18, 2025
1 parent 5f5444b commit 2b078eb
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export async function downloadTelemetryTemplate({ githubToken }: { githubToken:
},
});

if (Array.isArray(file.data)) {
if (!Array.isArray(file.data) && file.data.type === 'file') {
return JSON.parse(Buffer.from(file.data.content!, 'base64').toString()) as {
index_patterns: string[];
mappings: {
properties: Record<string, any>;
};
settings: Record<string, any>;
};
} else {
throw new Error('Expected single response, got array');
}

return JSON.parse(Buffer.from(file.data.content!, 'base64').toString()) as {
index_patterns: string[];
mappings: {
properties: Record<string, any>;
};
settings: Record<string, any>;
};
}

0 comments on commit 2b078eb

Please sign in to comment.