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
|
* 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
|
* has been set, otherwise it is deduced as all languages in the repo that
|
||||||
* can be analysed.
|
* can be analysed.
|
||||||
|
*
|
||||||
|
* If no languages could be detected from either the workflow or the repository
|
||||||
|
* then throw an error.
|
||||||
*/
|
*/
|
||||||
async function getLanguages() {
|
async function getLanguages() {
|
||||||
// Obtain from action input 'languages' if set
|
// Obtain from action input 'languages' if set
|
||||||
|
|
@ -341,6 +344,12 @@ async function getLanguages() {
|
||||||
languages = await getLanguagesInRepo();
|
languages = await getLanguagesInRepo();
|
||||||
core.info("Automatically detected languages: " + JSON.stringify(languages));
|
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;
|
return languages;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -384,11 +393,6 @@ async function loadConfig(configFile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const languages = await getLanguages();
|
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 queries = {};
|
||||||
const pathsIgnore = [];
|
const pathsIgnore = [];
|
||||||
const paths = [];
|
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
|
* 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
|
* has been set, otherwise it is deduced as all languages in the repo that
|
||||||
* can be analysed.
|
* 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[]> {
|
async function getLanguages(): Promise<string[]> {
|
||||||
|
|
||||||
|
|
@ -468,6 +471,13 @@ async function getLanguages(): Promise<string[]> {
|
||||||
core.info("Automatically detected languages: " + JSON.stringify(languages));
|
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;
|
return languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -515,11 +525,6 @@ async function loadConfig(configFile: string): Promise<Config> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const languages = await getLanguages();
|
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 queries = {};
|
||||||
const pathsIgnore: string[] = [];
|
const pathsIgnore: string[] = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue