Add useful information to MRVA gist titles
All exported MRVA gists are given the name `CodeQL variant analysis results', which makes it hard to work out what it contains at a glance. We're adding more information in the gist title to make it more useful. Example of new title: `Empty Block (Go) x results (y repositories)` This translates to: `<query name> (<query language>) <number of results> results (<number of repositories> repositories)` Co-authored-by: Shati Patel <shati-patel@github.com>
This commit is contained in:
@@ -80,7 +80,7 @@ async function exportResultsToGist(
|
||||
analysesResults: AnalysisResults[]
|
||||
): Promise<void> {
|
||||
const credentials = await Credentials.initialize(ctx);
|
||||
const description = 'CodeQL Variant Analysis Results';
|
||||
const description = buildGistDescription(query, analysesResults);
|
||||
const markdownFiles = generateMarkdown(query, analysesResults, 'gist');
|
||||
// Convert markdownFiles to the appropriate format for uploading to gist
|
||||
const gistFiles = markdownFiles.reduce((acc, cur) => {
|
||||
@@ -100,6 +100,15 @@ async function exportResultsToGist(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds Gist description
|
||||
* Ex: Empty Block (Go) x results (y repositories)
|
||||
*/
|
||||
const buildGistDescription = (query: RemoteQuery, analysesResults: AnalysisResults[]) => {
|
||||
const resultCount = sumAnalysesResults(analysesResults);
|
||||
return `${query.queryName} (${query.language}) ${resultCount} results (${query.numRepositoriesQueried} repositories)`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the results of a remote query to markdown and saves the files locally
|
||||
* in the query directory (where query results and metadata are also saved).
|
||||
|
||||
Reference in New Issue
Block a user