improve error message when no languages are detected
This commit is contained in:
parent
30d2cce9f8
commit
4896ba51da
3 changed files with 20 additions and 11 deletions
14
lib/config-utils.js
generated
14
lib/config-utils.js
generated
|
|
@ -328,6 +328,9 @@ async function getLanguagesInRepo() {
|
|||
* The result is obtained from the action input parameter 'languages' if that
|
||||
* has been set, otherwise it is deduced as all languages in the repo that
|
||||
* can be analysed.
|
||||
*
|
||||
* If no languages could be detected from either the workflow or the repository
|
||||
* then throw an error.
|
||||
*/
|
||||
async function getLanguages() {
|
||||
// Obtain from action input 'languages' if set
|
||||
|
|
@ -341,6 +344,12 @@ async function getLanguages() {
|
|||
languages = await getLanguagesInRepo();
|
||||
core.info("Automatically detected languages: " + JSON.stringify(languages));
|
||||
}
|
||||
// If the languages parameter was not given and no languages were
|
||||
// detected then fail here as this is a workflow configuration error.
|
||||
if (languages.length === 0) {
|
||||
throw new Error("Did not detect any languages to analyze. " +
|
||||
"Please update input in workflow or check that GitHub detects the correct languages in your repository.");
|
||||
}
|
||||
return languages;
|
||||
}
|
||||
/**
|
||||
|
|
@ -384,11 +393,6 @@ async function loadConfig(configFile) {
|
|||
}
|
||||
}
|
||||
const languages = await getLanguages();
|
||||
// If the languages parameter was not given and no languages were
|
||||
// detected then fail here as this is a workflow configuration error.
|
||||
if (languages.length === 0) {
|
||||
throw new Error("Did not detect any languages to analyze. Please update input in workflow.");
|
||||
}
|
||||
const queries = {};
|
||||
const pathsIgnore = [];
|
||||
const paths = [];
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -452,6 +452,9 @@ async function getLanguagesInRepo(): Promise<string[]> {
|
|||
* The result is obtained from the action input parameter 'languages' if that
|
||||
* has been set, otherwise it is deduced as all languages in the repo that
|
||||
* can be analysed.
|
||||
*
|
||||
* If no languages could be detected from either the workflow or the repository
|
||||
* then throw an error.
|
||||
*/
|
||||
async function getLanguages(): Promise<string[]> {
|
||||
|
||||
|
|
@ -468,6 +471,13 @@ async function getLanguages(): Promise<string[]> {
|
|||
core.info("Automatically detected languages: " + JSON.stringify(languages));
|
||||
}
|
||||
|
||||
// If the languages parameter was not given and no languages were
|
||||
// detected then fail here as this is a workflow configuration error.
|
||||
if (languages.length === 0) {
|
||||
throw new Error("Did not detect any languages to analyze. " +
|
||||
"Please update input in workflow or check that GitHub detects the correct languages in your repository.");
|
||||
}
|
||||
|
||||
return languages;
|
||||
}
|
||||
|
||||
|
|
@ -515,11 +525,6 @@ async function loadConfig(configFile: string): Promise<Config> {
|
|||
}
|
||||
|
||||
const languages = await getLanguages();
|
||||
// If the languages parameter was not given and no languages were
|
||||
// detected then fail here as this is a workflow configuration error.
|
||||
if (languages.length === 0) {
|
||||
throw new Error("Did not detect any languages to analyze. Please update input in workflow.");
|
||||
}
|
||||
|
||||
const queries = {};
|
||||
const pathsIgnore: string[] = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue