Skip to content

Commit bdfd482

Browse files
committed
Merge branch 'main' into query-overriding
2 parents 129713f + bd54c20 commit bdfd482

3,443 files changed

Lines changed: 451541 additions & 2466 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cli.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "CodeScanning CLI"
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
# Build the CLI
13+
- name: Build CLI
14+
run: npm run build-cli
15+
16+
# Upload an empty SARIF file
17+
- name: Upload with CLI
18+
run: node cli/code-scanning-cli.js upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_API_URL --github-auth ${{ github.token }}

.github/workflows/integration-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
env:
2323
TEST_MODE: true
2424
- run: |
25-
cd "$CODEQL_ACTION_DATABASE_DIR"
25+
cd "$RUNNER_TEMP/codeql_databases"
2626
# List all directories as there will be precisely one directory per database
2727
# but there may be other files in this directory such as query suites.
2828
if [ "$(ls -d */ | wc -l)" != 6 ] || \

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/cli/
2+

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ This project also includes configuration to run tests from VSCode (with support
2626

2727
To see the effect of your changes and to test them, push your changes in a branch and then look at the [Actions output](https://github.com/github/codeql-action/actions) for that branch. You can also exercise the code locally by running the automated tests.
2828

29+
### Running the action locally
30+
31+
It is possible to run this action locally via [act](https://github.com/nektos/act) via the following steps:
32+
33+
1. Create a GitHub [Personal Access Token](https://github.com/settings/tokens) (PAT).
34+
1. Install [act](https://github.com/nektos/act) v0.2.10 or greater.
35+
1. Add a `.env` file in the root of the project you are running:
36+
37+
```bash
38+
CODEQL_LOCAL_RUN=true
39+
40+
# Optional, for better logging
41+
GITHUB_JOB=<ANY_JOB_NAME>
42+
```
43+
44+
1. Run `act -j codeql -s GITHUB_TOKEN=<PAT>`
45+
46+
Running locally will generate the CodeQL database and run all the queries, but it will avoid uploading and reporting results to GitHub. Note that this must be done on a repository that _consumes_ this action, not this repository. The use case is to debug failures of this action on specific repositories.
47+
2948
### Integration tests
3049

3150
As well as the unit tests (see _Common tasks_ above), there are integration tests, defined in `.github/workflows/integration-testing.yml`. These are run by a CI check. Depending on the change you’re making, you may want to add a test to this file or extend an existing one.

analyze/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ inputs:
1919
threads:
2020
description: The number of threads to be used by CodeQL.
2121
required: false
22-
default: "1"
2322
checkout_path:
2423
description: "The path at which the analyzed repository was checked out. Used to relativeize any absolute paths in the uploaded SARIF file."
2524
required: false

init/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
tools:
66
description: URL of CodeQL tools
77
required: false
8-
default: https://github.com/github/codeql-action/releases/download/codeql-bundle-20200630/codeql-bundle.tar.gz
8+
# If not specified the Action will check in several places until it finds the CodeQL tools.
99
languages:
1010
description: The languages to be analysed
1111
required: false

lib/analysis-paths.test.js

Lines changed: 33 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analysis-paths.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api-client.js

Lines changed: 26 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api-client.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)