You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning.md
+43-1Lines changed: 43 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -388,7 +388,7 @@ You can also specify query suites in the value of `queries`. Query suites are co
388
388
```yaml{:copy}
389
389
- uses: {% data reusables.actions.action-codeql-action-init %}
390
390
with:
391
-
# Comma-separated list of queries / packs / suites to run.
391
+
# Comma-separated list of queries / packs / suites to run.
392
392
# This may include paths or a built in suite, for example:
393
393
# security-extended or security-and-quality.
394
394
queries: security-extended
@@ -571,6 +571,48 @@ You can quickly analyze small portions of a monorepo when you modify code in spe
571
571
572
572
{% data reusables.code-scanning.example-configuration-files %}
573
573
574
+
{% ifversion code-scanning-config-input %}
575
+
## Specifying configuration details using the `config` input
576
+
577
+
If you'd prefer to specify additional configuration details in the workflow file, you can use the `config` input of the `init` command of the {% data variables.product.prodname_codeql %} action. The value of this input must be a YAML string that follows the configuration file format documented at "[Using a custom configuration file](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning#using-a-custom-configuration-file)" above.
578
+
579
+
### Example configuration
580
+
581
+
This step in a {% data variables.product.prodname_actions %} workflow file uses a `config` input to disable the default queries, add the `security-extended` query suite, and exclude queries that are tagged with `cwe-020`.
582
+
583
+
```yaml
584
+
- uses: {% data reusables.actions.action-codeql-action-init %}
585
+
with:
586
+
languages: {% raw %}${{ matrix.language }}{% endraw %}
587
+
config: |
588
+
disable-default-queries: true
589
+
queries:
590
+
- uses: security-extended
591
+
query-filters:
592
+
- exclude:
593
+
tags: /cwe-020/
594
+
```
595
+
596
+
You can use the same approach to specify any valid configuration options in the workflow file.
597
+
598
+
{% tip %}
599
+
600
+
**Tip:**
601
+
602
+
You can share one configuration across multiple repositories using {% data variables.product.prodname_actions %} variables. One benefit of this approach is that you can update the configuration in a single place without editing the workflow file.
603
+
604
+
In the following example, `vars.CODEQL_CONF` is a {% data variables.product.prodname_actions %} variable. Its value can be the contents of any valid configuration file. For more information, see "[AUTOTITLE](/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows)."
605
+
606
+
```yaml
607
+
- uses: {% data reusables.actions.action-codeql-action-init %}
608
+
with:
609
+
languages: {% raw %}${{ matrix.language }}{% endraw %}
610
+
config: {% raw %}${{ vars.CODEQL_CONF }}{% endraw %}
611
+
```
612
+
613
+
{% endtip %}
614
+
{% endif %}
615
+
574
616
## Configuring {% data variables.product.prodname_code_scanning %} for compiled languages
575
617
576
618
{% data reusables.code-scanning.autobuild-compiled-languages %} {% data reusables.code-scanning.analyze-go %}
0 commit comments