fix after review from @henrymercer

This commit is contained in:
tgrall 2023-04-18 05:43:21 +02:00
parent fc374f5e9a
commit f398a65921
7 changed files with 39 additions and 37 deletions

3
lib/config-utils.js generated
View file

@ -936,6 +936,9 @@ async function initConfig(languagesInput, queriesInput, packsInput, registriesIn
let config;
// if configInput is set, it takes precedence over configFile
if (configInput) {
if (configFile) {
logger.warning(`Both a config file and config input were provided. Ignoring config file.`);
}
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
fs.writeFileSync(configFile, configInput);
logger.debug(`Using config from action input: ${configFile}`);

File diff suppressed because one or more lines are too long

View file

@ -495,9 +495,9 @@ function queriesToResolvedQueryForm(queries) {
t.true(config.queries["javascript"].custom[2].queries[0].endsWith(`${path.sep}foo`));
});
});
(0, ava_1.default)("Queries can be specified in configuration, same as file", async (t) => {
(0, ava_1.default)("Queries can be specified using config input", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
const inputFileContents = `
const configInput = `
name: my config
queries:
- uses: ./foo
@ -520,7 +520,7 @@ function queriesToResolvedQueryForm(queries) {
});
// Only JS, python packs will be ignored
const languages = "javascript";
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, inputFileContents, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, configInput, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
// Check resolveQueries was called correctly
// It'll be called once for the default queries
// and once for `./foo` from the config file.

File diff suppressed because one or more lines are too long