Skip to content

Commit 280c475

Browse files
authored
Merge pull request #25484 from github/repo-sync
repo sync
2 parents 55c65cf + 2479519 commit 280c475

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ You can also specify query suites in the value of `queries`. Query suites are co
388388
``` yaml{:copy}
389389
- uses: {% data reusables.actions.action-codeql-action-init %}
390390
with:
391-
# Comma-separated list of queries / packs / suites to run.
391+
# Comma-separated list of queries / packs / suites to run.
392392
# This may include paths or a built in suite, for example:
393393
# security-extended or security-and-quality.
394394
queries: security-extended
@@ -571,6 +571,48 @@ You can quickly analyze small portions of a monorepo when you modify code in spe
571571

572572
{% data reusables.code-scanning.example-configuration-files %}
573573

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+
574616
## Configuring {% data variables.product.prodname_code_scanning %} for compiled languages
575617

576618
{% data reusables.code-scanning.autobuild-compiled-languages %} {% data reusables.code-scanning.analyze-go %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Versions that support the `config` input in the `github/codeql-action/init@v2`` action
2+
versions:
3+
fpt: '*'
4+
ghec: '*'
5+
ghes: '>3.9'
6+
ghae: '>3.9'

0 commit comments

Comments
 (0)