Skip to content

Commit 3346195

Browse files
authored
Merge branch 'main' into update-bundle/codeql-bundle-20230428
2 parents 40c9593 + 8ca5570 commit 3346195

15 files changed

+402
-55
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [UNRELEASED]
44

55
- Update default CodeQL bundle version to 2.13.1. [#1664](https://github.com/github/codeql-action/pull/1664)
6+
- You can now configure CodeQL within your code scanning workflow by passing a `config` input to the `init` Action. See [Using a custom configuration file](https://aka.ms/code-scanning-docs/config-file) for more information about configuring code scanning. [#1590](https://github.com/github/codeql-action/pull/1590)
67

78
## 2.3.2 - 27 Apr 2023
89

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,38 @@ By default, this will override any queries specified in a config file. If you wi
135135
queries: +<local-or-remote-query>,<another-query>
136136
```
137137

138+
### Configuration via `config` input
139+
140+
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://aka.ms/code-scanning-docs/config-file)."
141+
142+
#### Example configuration
143+
144+
```yaml
145+
- uses: github/codeql-action/init@v2
146+
with:
147+
languages: ${{ matrix.language }}
148+
config: |
149+
disable-default-queries: true
150+
queries:
151+
- uses: security-extended
152+
- uses: security-and-quality
153+
query-filters:
154+
- include:
155+
tags: /cwe-020/
156+
```
157+
158+
159+
#### Sharing configuration across multiple repositories
160+
161+
You can use Actions or environment variables to share configuration across multiple repositories and to modify configuration without needing to edit the workflow file. In the following example, `vars.CODEQL_CONF` is an [Actions configuration variable](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows):
162+
163+
```yaml
164+
- uses: github/codeql-action/init@v2
165+
with:
166+
languages: ${{ matrix.language }}
167+
config: ${{ vars.CODEQL_CONF }}
168+
```
169+
138170
## Troubleshooting
139171

140172
Read about [troubleshooting code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning).
141-

init/action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ inputs:
4444
db-location:
4545
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
4646
required: false
47+
config:
48+
description: Configuration passed as a YAML string in the same format as the config-file input. This takes precedence over the config-file input.
49+
required: false
4750
queries:
4851
description: Comma-separated list of additional queries to run. By default, this overrides the same setting in a configuration file; prefix with "+" to use both sets of queries.
4952
required: false

lib/config-utils.js

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js

+114-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)