resolve comments from @henrymercer
This commit is contained in:
parent
0b75f471b1
commit
b4e6f81a72
9 changed files with 21 additions and 25 deletions
|
|
@ -135,10 +135,11 @@ By default, this will override any queries specified in a config file. If you wi
|
|||
queries: +<local-or-remote-query>,<another-query>
|
||||
```
|
||||
|
||||
### Configuration
|
||||
### Configuration via `config` input
|
||||
|
||||
|
||||
Use the `config` parameter of the `init` action to enable a workflow based configuration. The value of `configuration` should be compliant with the configuration file format documented at [Using a custom configuration file](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#using-a-custom-configuration-file)."
|
||||
You can alternatively configure CodeQL using the `config` input to the `init` Action. The value of this input must be a YAML string that follows the configuration file format documented at "[Using a custom configuration file](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#using-a-custom-configuration-file)."
|
||||
|
||||
|
||||
|
||||
- **Complete Configuration**
|
||||
|
|
|
|||
11
lib/config-utils.js
generated
11
lib/config-utils.js
generated
|
|
@ -932,13 +932,12 @@ function dbLocationOrDefault(dbLocation, tempDir) {
|
|||
* This will parse the config from the user input if present, or generate
|
||||
* a default config. The parsed config is then stored to a known location.
|
||||
*/
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configAsParameter, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
||||
let config;
|
||||
// if configAsParameter is set, it takes precedence over configFile
|
||||
if (configAsParameter) {
|
||||
const configFileToCreate = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||
fs.writeFileSync(configFileToCreate, configAsParameter);
|
||||
configFile = configFileToCreate;
|
||||
// if configInput is set, it takes precedence over configFile
|
||||
if (configInput) {
|
||||
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||
fs.writeFileSync(configFile, configInput);
|
||||
logger.debug(`Using config from action input: ${configFile}`);
|
||||
}
|
||||
// If no config file was provided create an empty one
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
lib/init.js
generated
4
lib/init.js
generated
|
|
@ -49,9 +49,9 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
||||
}
|
||||
exports.initCodeQL = initCodeQL;
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configAsParameter, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
||||
logger.startGroup("Load language configuration");
|
||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configAsParameter, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger);
|
||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger);
|
||||
analysisPaths.printPathFiltersWarning(config, logger);
|
||||
logger.endGroup();
|
||||
return config;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1690,7 +1690,7 @@ export async function initConfig(
|
|||
registriesInput: string | undefined,
|
||||
configFile: string | undefined,
|
||||
dbLocation: string | undefined,
|
||||
configAsParameter: string | undefined,
|
||||
configInput: string | undefined,
|
||||
trapCachingEnabled: boolean,
|
||||
debugMode: boolean,
|
||||
debugArtifactName: string,
|
||||
|
|
@ -1706,14 +1706,10 @@ export async function initConfig(
|
|||
): Promise<Config> {
|
||||
let config: Config;
|
||||
|
||||
// if configAsParameter is set, it takes precedence over configFile
|
||||
if (configAsParameter) {
|
||||
const configFileToCreate = path.resolve(
|
||||
workspacePath,
|
||||
"user-config-from-action.yml"
|
||||
);
|
||||
fs.writeFileSync(configFileToCreate, configAsParameter);
|
||||
configFile = configFileToCreate;
|
||||
// if configInput is set, it takes precedence over configFile
|
||||
if (configInput) {
|
||||
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||
fs.writeFileSync(configFile, configInput);
|
||||
logger.debug(`Using config from action input: ${configFile}`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export async function initConfig(
|
|||
registriesInput: string | undefined,
|
||||
configFile: string | undefined,
|
||||
dbLocation: string | undefined,
|
||||
configAsParameter: string | undefined,
|
||||
configInput: string | undefined,
|
||||
trapCachingEnabled: boolean,
|
||||
debugMode: boolean,
|
||||
debugArtifactName: string,
|
||||
|
|
@ -80,7 +80,7 @@ export async function initConfig(
|
|||
registriesInput,
|
||||
configFile,
|
||||
dbLocation,
|
||||
configAsParameter,
|
||||
configInput,
|
||||
trapCachingEnabled,
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue