Skip to content

Commit 675843d

Browse files
authored
Merge pull request #549 from github/update-v1.0.1-242fd828
Merge main into v1
2 parents 4917d3c + 511fe43 commit 675843d

File tree

190 files changed

+14142
-6814
lines changed

Some content is hidden

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

190 files changed

+14142
-6814
lines changed

.github/workflows/post-release-mergeback.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,27 @@ jobs:
7474
set +e # don't fail on an errored command
7575
git ls-remote --tags origin | grep "$VERSION"
7676
EXISTS="$?"
77-
if [ "$EXISTS" -ne 0 ]; then
78-
echo "::set-output name=exists::true"
79-
echo "Tag $TAG exists. Not going to re-release."
77+
if [ "$EXISTS" -eq 0 ]; then
78+
echo "Tag $TAG exists. Not going to re-release."
79+
echo "::set-output name=exists::true"
80+
else
81+
echo "Tag $TAG does not exist yet."
8082
fi
8183
8284
# we didn't tag the release during the update-release-branch workflow because the
8385
# commit that actually makes it to the release branch is a merge commit,
8486
# and not yet known during the first workflow. We tag now because we know the correct commit.
8587
- name: Tag release
86-
if: steps.check.outputs.exists == 'true'
88+
if: steps.check.outputs.exists != 'true'
8789
env:
8890
VERSION: ${{ steps.getVersion.outputs.version }}
8991
run: |
9092
git tag -a "$VERSION" -m "$VERSION"
93+
git fetch --unshallow # unshallow the repo in order to allow pushes
9194
git push origin --follow-tags "$VERSION"
9295
9396
- name: Create mergeback branch
94-
if: steps.check.outputs.exists == 'true'
97+
if: steps.check.outputs.exists != 'true'
9598
env:
9699
VERSION: "${{ steps.getVersion.outputs.version }}"
97100
NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}"

.github/workflows/pr-checks.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,38 @@ jobs:
6565
shell: bash
6666
run: ./build.sh
6767
- uses: ./../action/analyze
68+
id: analysis
6869
env:
6970
TEST_MODE: true
7071
- run: |
71-
cd "$RUNNER_TEMP/customDbLocation"
72-
# List all directories as there will be precisely one directory per database
73-
# but there may be other files in this directory such as query suites.
74-
if [ "$(ls -d */ | wc -l)" != 6 ] || \
75-
[[ ! -d cpp ]] || \
76-
[[ ! -d csharp ]] || \
77-
[[ ! -d go ]] || \
78-
[[ ! -d java ]] || \
79-
[[ ! -d javascript ]] || \
80-
[[ ! -d python ]]; then
81-
echo "Did not find expected number of databases. Database dir contains: $(ls)"
72+
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
73+
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
74+
echo "Did not create a database for CPP, or created it in the wrong location."
75+
exit 1
76+
fi
77+
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
78+
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
79+
echo "Did not create a database for C Sharp, or created it in the wrong location."
80+
exit 1
81+
fi
82+
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
83+
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
84+
echo "Did not create a database for Go, or created it in the wrong location."
85+
exit 1
86+
fi
87+
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
88+
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
89+
echo "Did not create a database for Java, or created it in the wrong location."
90+
exit 1
91+
fi
92+
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
93+
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
94+
echo "Did not create a database for Javascript, or created it in the wrong location."
95+
exit 1
96+
fi
97+
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
98+
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
99+
echo "Did not create a database for Python, or created it in the wrong location."
82100
exit 1
83101
fi
84102

.github/workflows/script/check-node-modules.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ npm run removeNPMAbsolutePaths
1414
# Check that repo is still clean
1515
if [ ! -z "$(git status --porcelain)" ]; then
1616
# If we get a fail here then the PR needs attention
17-
>&2 echo "Failed: node_modules are not up to date. Run 'npm ci' and 'npm run removeNPMAbsolutePaths' to update"
17+
>&2 echo "Failed: node_modules are not up to date. Run 'npm ci && npm run removeNPMAbsolutePaths' on a macOS machine to update. Note it is important this command is run on macOS and not any other operating system as there is one dependency (fsevents) that is needed for macOS and may not be installed if the command is run on a Windows or Linux machine."
1818
git status
1919
exit 1
2020
fi

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# CodeQL Action and CodeQL Runner Changelog
22

3+
## 1.0.1 - 07 Jun 2021
4+
5+
- Pass the `--sarif-group-rules-by-pack` argument to CodeQL CLI invocations that generate SARIF. This means the SARIF rule object for each query will now be found underneath its corresponding query pack in `runs[].tool.extensions`. [#546](https://github.com/github/codeql-action/pull/546)
6+
- Output the location of CodeQL databases created in the analyze step. [#543](https://github.com/github/codeql-action/pull/543)
7+
38
## 1.0.0 - 31 May 2021
49

510
- Add this changelog file. [#507](https://github.com/github/codeql-action/pull/507)
611
- Improve grouping of analysis logs. Add a new log group containing a summary of metrics and diagnostics, if they were produced by CodeQL builtin queries. [#515](https://github.com/github/codeql-action/pull/515)
7-
- Add metrics and diagnostics summaries from custom query suites to the analysis summary log group. [#532](https://github.com/github/codeql-action/pull/532)
12+
- Add metrics and diagnostics summaries from custom query suites to the analysis summary log group. [#532](https://github.com/github/codeql-action/pull/532)

CONTRIBUTING.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Please note that this project is released with a [Contributor Code of Conduct][c
1212

1313
## Development and Testing
1414

15-
Before you start, ensure that you have a recent version of node installed. You can see which version of node is used by the action in `init/action.yml`.
15+
Before you start, ensure that you have a recent version of node (14 or higher) installed, along with a recent version of npm (7 or higher). You can see which version of node is used by the action in `init/action.yml`.
1616

1717
### Common tasks
1818

@@ -28,32 +28,12 @@ You may want to run `tsc --watch` from the command line or inside of vscode in o
2828

2929
Because CodeQL Action users consume the code directly from this repository, and there can be no build step during an GitHub Actions run, this repository contains all compiled artifacts and node modules. There is a PR check that will fail if any of the compiled artifacts are not up to date. Compiled artifacts are stored in the `lib/` directory. For all day-to-day development purposes, this folder can be ignored.
3030

31-
Only run `npm install` if you are explicitly changing the set of dependencies in `package.json`. The `node_modules` directory should be up to date when you check out, but if for some reason, there is an inconsistency use `npm ci && npm run removeNPMAbsolutePaths` to ensure the directory is in a state consistent with the `package-lock.json`. There is a PR check to ensure the consistency of the `node_modules` directory.
31+
Only run `npm install` if you are explicitly changing the set of dependencies in `package.json`. The `node_modules` directory should be up to date when you check out, but if for some reason, there is an inconsistency use `npm ci && npm run removeNPMAbsolutePaths` to ensure the directory is in a state consistent with the `package-lock.json`. Note that due to a macOS-specific dependency, this command should be run on a macOS machine. There is a PR check to ensure the consistency of the `node_modules` directory.
3232

3333
### Running the action
3434

3535
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.
3636

37-
### Running the action locally
38-
39-
It is possible to run this action locally via [act](https://github.com/nektos/act) via the following steps:
40-
41-
1. Create a GitHub [Personal Access Token](https://github.com/settings/tokens) (PAT).
42-
1. Install [act](https://github.com/nektos/act) v0.2.10 or greater.
43-
1. Add a `.env` file in the root of the project you are running:
44-
45-
```bash
46-
CODEQL_LOCAL_RUN=true
47-
GITHUB_SERVER_URL=https://github.com
48-
49-
# Optional, for better logging
50-
GITHUB_JOB=<ANY_JOB_NAME>
51-
```
52-
53-
1. Run `act -j codeql -s GITHUB_TOKEN=<PAT>`
54-
55-
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.
56-
5737
### Integration tests
5838

5939
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.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CodeQL Action
22

3-
This action runs GitHub's industry-leading static analysis engine, CodeQL, against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.
3+
This action runs GitHub's industry-leading semantic code analysis engine, CodeQL, against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.
44

55
For a list of recent changes, see the CodeQL Action's [changelog](CHANGELOG.md).
66

analyze/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
description: Upload the SARIF file
1414
required: false
1515
default: "true"
16+
cleanup-level:
17+
description: "Level of cleanup to perform on CodeQL databases at the end of the analyze step. This should either be 'none' to skip cleanup, or be a valid argument for the --mode flag of the CodeQL CLI command 'codeql database cleanup' as documented at https://codeql.github.com/docs/codeql-cli/manual/database-cleanup"
18+
required: false
19+
default: "brutal"
1620
ram:
1721
description: Override the amount of memory in MB to be used by CodeQL. By default, almost all the memory of the machine is used.
1822
required: false
@@ -34,6 +38,9 @@ inputs:
3438
default: ${{ github.token }}
3539
matrix:
3640
default: ${{ toJson(matrix) }}
41+
outputs:
42+
db-locations:
43+
description: A map from language to absolute path for each database created by CodeQL.
3744
runs:
3845
using: 'node12'
3946
main: '../lib/analyze-action.js'

lib/actions-util.js

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

0 commit comments

Comments
 (0)