Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/codeql-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.26.6
Choose a base ref
...
head repository: github/codeql-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.26.7
Choose a head ref

Commits on Aug 28, 2024

  1. Use cache-cleanup command line option

    The --mode command line option to has been renamed to --cache-cleanup
    paldepind committed Aug 28, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    e4525ac View commit details
  2. Use GitHub App for authz

    rvermeulen committed Aug 28, 2024
    Copy the full SHA
    0f99b63 View commit details

Commits on Aug 29, 2024

  1. Copy the full SHA
    8fdccc5 View commit details
  2. Copy the full SHA
    d905212 View commit details
  3. Merge pull request #2453 from github/mergeback/v3.26.6-to-main-4dd16135

    Mergeback v3.26.6 refs/heads/releases/v3 into main
    henrymercer authored Aug 29, 2024
    Copy the full SHA
    b43ac1c View commit details
  4. Go: Bump Go version to 1.23

    mbg committed Aug 29, 2024
    Copy the full SHA
    f3f8576 View commit details
  5. Copy the full SHA
    e257226 View commit details
  6. Copy the full SHA
    cf64c3e View commit details
  7. Copy the full SHA
    ffa1b05 View commit details
  8. Copy the full SHA
    335044a View commit details
  9. Copy the full SHA
    6240306 View commit details
  10. Copy the full SHA
    379271d View commit details
  11. Infer compression method from URL

    Using the downloaded path is unreliable since we may have removed the file extension.
    henrymercer committed Aug 29, 2024
    Copy the full SHA
    27dbb1a View commit details
  12. Change "recommended" to "minimum"

    The wording was causing confusion.
    aeisenberg committed Aug 29, 2024
    Copy the full SHA
    c283379 View commit details

Commits on Aug 30, 2024

  1. Merge pull request #2442 from github/henrymercer/zstd-bundles

    Add support for using zstd-compressed nightly bundles
    henrymercer authored Aug 30, 2024
    Copy the full SHA
    821ab42 View commit details
  2. Update README.md

    aeisenberg authored Aug 30, 2024
    Copy the full SHA
    693677d View commit details

Commits on Sep 2, 2024

  1. Copy the full SHA
    9a16e92 View commit details
  2. Copy the full SHA
    878047b View commit details
  3. Bump the npm group with 3 updates

    Bumps the npm group with 3 updates: [adm-zip](https://github.com/cthackers/adm-zip), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).
    
    
    Updates `adm-zip` from 0.5.15 to 0.5.16
    - [Release notes](https://github.com/cthackers/adm-zip/releases)
    - [Changelog](https://github.com/cthackers/adm-zip/blob/master/history.md)
    - [Commits](cthackers/adm-zip@v0.5.15...v0.5.16)
    
    Updates `@typescript-eslint/eslint-plugin` from 8.2.0 to 8.4.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.4.0/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 8.2.0 to 8.4.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.4.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: adm-zip
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: npm
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: npm
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: npm
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2024
    Copy the full SHA
    52df12d View commit details
  4. Copy the full SHA
    294a6ed View commit details

Commits on Sep 3, 2024

  1. Merge pull request #2457 from github/dependabot/npm_and_yarn/npm-689a…

    …6f074c
    
    Bump the npm group with 3 updates
    henrymercer authored Sep 3, 2024
    Copy the full SHA
    b4a8631 View commit details

Commits on Sep 4, 2024

  1. Merge pull request #2450 from paldepind/use-cache-cleanup-flag

    Use cache-cleanup command line option
    paldepind authored Sep 4, 2024
    Copy the full SHA
    4ac5f37 View commit details
  2. Merge pull request #2451 from github/aeisenberg/recommended

    Change "recommended" to "minimum"
    aeisenberg authored Sep 4, 2024
    Copy the full SHA
    889597e View commit details

Commits on Sep 5, 2024

  1. Fix formatting issue with GHES compatibility table

    Also add a note about GHES 3.11 supporting but not shipping with CodeQL Action v3.
    henrymercer authored Sep 5, 2024
    Copy the full SHA
    77f9025 View commit details
  2. Copy the full SHA
    de6fe7e View commit details
  3. Copy the full SHA
    90cf3d2 View commit details
  4. Merge pull request #2462 from github/henrymercer/fix-ghes-table

    Fix formatting issue with GHES compatibility table
    henrymercer authored Sep 5, 2024
    Copy the full SHA
    3b0aa30 View commit details
  5. Merge pull request #2463 from github/henrymercer/job-uuid-in-sarif

     Add job run UUID to SARIF output
    henrymercer authored Sep 5, 2024
    Copy the full SHA
    ad5c608 View commit details
  6. Copy the full SHA
    0aafba9 View commit details
  7. Merge pull request #2464 from github/henrymercer/tools-url-status-report

    Add standard tools URLs to status report
    henrymercer authored Sep 5, 2024
    Copy the full SHA
    9b41ced View commit details

Commits on Sep 6, 2024

  1. Merge pull request #2455 from github/mbg/go/1.23

    Go: Bump Go version to 1.23 in tests
    mbg authored Sep 6, 2024
    Copy the full SHA
    d8b1697 View commit details

Commits on Sep 9, 2024

  1. Copy the full SHA
    55c72b9 View commit details
  2. Update setup-swift version

    Allows running swift v5.10.1.
    aeisenberg committed Sep 9, 2024
    Copy the full SHA
    c00e239 View commit details
  3. Merge pull request #2470 from github/aeisenberg/update-setup-swift

    Update setup-swift version
    aeisenberg authored Sep 9, 2024
    Copy the full SHA
    8fd294e View commit details
  4. Copy the full SHA
    5c9d953 View commit details

Commits on Sep 10, 2024

  1. Copy the full SHA
    2a9bba1 View commit details
  2. Copy the full SHA
    8d9ed0b View commit details
  3. Copy the full SHA
    f824adb View commit details
  4. Ignore suppressed alerts

    aeisenberg committed Sep 10, 2024
    Copy the full SHA
    56b8418 View commit details
  5. Merge pull request #2472 from rvermeulen/rvermeulen/update-release-br…

    …anch-authz
    
    Address authentication issue release branch update
    rvermeulen authored Sep 10, 2024
    Copy the full SHA
    49021ad View commit details
  6. Merge pull request #2469 from github/aeisenberg/upload-eslint-sarif

    Upload sarif for eslint results
    aeisenberg authored Sep 10, 2024
    Copy the full SHA
    e817992 View commit details
  7. Always upload eslint.sarif

    aeisenberg committed Sep 10, 2024
    Copy the full SHA
    0d0f998 View commit details

Commits on Sep 12, 2024

  1. Merge pull request #2471 from github/update-bundle/codeql-bundle-v2.18.4

    Update default bundle to 2.18.4
    dbartol authored Sep 12, 2024
    Copy the full SHA
    762dbae View commit details
  2. Merge pull request #2474 from github/aeisenberg/always-upload-eslint-…

    …sarif
    
    Always upload eslint.sarif
    aeisenberg authored Sep 12, 2024
    Copy the full SHA
    4a01ec7 View commit details

Commits on Sep 13, 2024

  1. Copy the full SHA
    a3b3e07 View commit details
  2. Merge pull request #2478 from github/update-v3.26.7-4a01ec798

    Merge main into releases/v3
    dbartol authored Sep 13, 2024
    Copy the full SHA
    8214744 View commit details
Showing 420 changed files with 20,719 additions and 1,408 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

14 changes: 10 additions & 4 deletions .github/actions/prepare-test/action.yml
Original file line number Diff line number Diff line change
@@ -32,14 +32,20 @@ runs:
run: |
set -e # Fail this Action if `gh release list` fails.
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
extension="tar.zst"
else
extension="tar.gz"
fi
if [[ ${{ inputs.use-all-platform-bundle }} == "true" ]]; then
artifact_name="codeql-bundle.tar.gz"
artifact_name="codeql-bundle.$extension"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
artifact_name="codeql-bundle-linux64.tar.gz"
artifact_name="codeql-bundle-linux64.$extension"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
artifact_name="codeql-bundle-osx64.tar.gz"
artifact_name="codeql-bundle-osx64.$extension"
elif [[ "$RUNNER_OS" == "Windows" ]]; then
artifact_name="codeql-bundle-win64.tar.gz"
artifact_name="codeql-bundle-win64.$extension"
else
echo "::error::Unrecognized OS $RUNNER_OS"
exit 1
8 changes: 4 additions & 4 deletions .github/actions/setup-swift/action.yml
Original file line number Diff line number Diff line change
@@ -11,15 +11,15 @@ runs:
id: get_swift_version
if: runner.os == 'Linux'
shell: bash
env:
env:
CODEQL_PATH: ${{ inputs.codeql-path }}
run: |
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
VERSION="null"
else
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/linux64/extractor" --version | awk '/version/ { print $3 }')"
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
if [ $VERSION = "5.7" ]; then
VERSION="5.7.0"
elif [ $VERSION = "5.8" ]; then
@@ -29,11 +29,11 @@ runs:
# setup-swift does not yet support v5.9.1 Remove this when it does.
elif [ $VERSION = "5.9.1" ]; then
VERSION="5.9.0"
fi
fi
fi
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
- uses: redsun82/setup-swift@b2b6f77ab14f6a9b136b520dc53ec8eca27d2b99 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
- uses: redsun82/setup-swift@362f49f31da2f5f4f851657046bdd1290d03edc8 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
with:
swift-version: "${{ steps.get_swift_version.outputs.version }}"
2 changes: 1 addition & 1 deletion .github/workflows/__go-tracing-autobuilder.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/__go-tracing-custom-build-steps.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/__go-tracing-legacy-workflow.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions .github/workflows/__job-run-uuid-sarif.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/__test-local-codeql.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,16 @@ jobs:
uses: actions/checkout@v4

- name: Lint
run: npm run-script lint
id: lint
run: npm run-script lint-ci

- name: Upload sarif
uses: github/codeql-action/upload-sarif@v3
# Only upload SARIF for the latest version of Node.js
if: "always() && matrix.node-types-version == 'current'"
with:
sarif_file: eslint.sarif
category: eslint

- name: Update version of @types/node
if: matrix.node-types-version != 'current'
10 changes: 9 additions & 1 deletion .github/workflows/update-release-branch.yml
Original file line number Diff line number Diff line change
@@ -104,6 +104,7 @@ jobs:
backport:
timeout-minutes: 45
runs-on: ubuntu-latest
environment: Automation
needs: [prepare]
if: ${{ (github.event_name == 'push') && needs.prepare.outputs.backport_target_branches != '[]' }}
strategy:
@@ -114,17 +115,24 @@ jobs:
SOURCE_BRANCH: ${{ needs.prepare.outputs.backport_source_branch }}
TARGET_BRANCH: ${{ matrix.target_branch }}
steps:
- uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4
id: app-token
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history for calculation of diffs
- uses: ./.github/actions/release-initialise

- name: Update older release branch
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
echo SOURCE_BRANCH=${SOURCE_BRANCH}
echo TARGET_BRANCH=${TARGET_BRANCH}
python .github/update-release-branch.py \
--github-token ${{ secrets.GITHUB_TOKEN }} \
--github-token ${GITHUB_TOKEN} \
--repository-nwo ${{ github.repository }} \
--source-branch ${SOURCE_BRANCH} \
--target-branch ${TARGET_BRANCH} \
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,3 +5,5 @@ node_modules/.cache/
*.class
# macOS
.DS_Store
# eslint sarif report
eslint.sarif
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th

Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.

## 3.26.7 - 13 Sep 2024

- Update default CodeQL bundle version to 2.18.4. [#2471](https://github.com/github/codeql-action/pull/2471)

## 3.26.6 - 29 Aug 2024

- Update default CodeQL bundle version to 2.18.3. [#2449](https://github.com/github/codeql-action/pull/2449)
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,20 +33,19 @@ To provide the best experience to customers using older versions of GitHub Enter

For more information, see "[Code scanning: deprecation of CodeQL Action v2](https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/)."

## Supported versions of the CodeQL Bundle and GitHub Enterprise Server
## Supported versions of the CodeQL Bundle on GitHub Enterprise Server

We typically release new minor versions of the CodeQL Action and Bundle when a new minor version of GitHub Enterprise Server (GHES) is released. When a version of GHES is deprecated, the CodeQL Action and Bundle releases that shipped with it are deprecated as well.

| Recommended CodeQL Action | Recommended CodeQL Bundle Version | GitHub Environment |
|---------|----------|--------------|
| `v3` | default (do not pass a `tools` input) | GitHub.com |
| `v3.25.11` | `2.17.6` | Enterprise Server 3.14 |
| `v3.24.11` | `2.16.6` | Enterprise Server 3.13 |
| `v3.22.12` | `2.15.5` | Enterprise Server 3.12 |
| `v2.22.1` | `2.14.6` | Enterprise Server 3.11 |
| `v2.20.3` | `2.13.5` | Enterprise Server 3.10 |
| Minimum CodeQL Action | Minimum CodeQL Bundle Version | GitHub Environment | Notes |
|-----------------------|-------------------------------|--------------------|-------|
| `v3.25.11` | `2.17.6` | Enterprise Server 3.14 | |
| `v3.24.11` | `2.16.6` | Enterprise Server 3.13 | |
| `v3.22.12` | `2.15.5` | Enterprise Server 3.12 | |
| `v2.22.1` | `2.14.6` | Enterprise Server 3.11 | Supports CodeQL Action v3, but did not ship with CodeQL Action v3. For more information, see "[Code scanning: deprecation of CodeQL Action v2](https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/#users-of-github-enterprise-server-311)." |
| `v2.20.3` | `2.13.5` | Enterprise Server 3.10 | Does not support CodeQL Action v3. |

CodeQL Action `v2` will stop receiving updates when GHES 3.11 is deprecated.
CodeQL Action v2 will stop receiving updates when GHES 3.11 is deprecated.

See the full list of GHES release and deprecation dates at [GitHub Enterprise Server releases](https://docs.github.com/en/enterprise-server/admin/all-releases#releases-of-github-enterprise-server).

2 changes: 1 addition & 1 deletion analyze/action.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ inputs:
# If changing this, make sure to update workflow.ts accordingly.
default: "always"
cleanup-level:
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"
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 --cache-cleanup flag of the CodeQL CLI command 'codeql database cleanup' as documented at https://codeql.github.com/docs/codeql-cli/manual/database-cleanup"
required: false
default: "brutal"
ram:
18 changes: 17 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions lib/defaults.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bundleVersion": "codeql-bundle-v2.18.3",
"cliVersion": "2.18.3",
"priorBundleVersion": "codeql-bundle-v2.18.2",
"priorCliVersion": "2.18.2"
"bundleVersion": "codeql-bundle-v2.18.4",
"cliVersion": "2.18.4",
"priorBundleVersion": "codeql-bundle-v2.18.3",
"priorCliVersion": "2.18.3"
}
17 changes: 17 additions & 0 deletions lib/init-action.js
2 changes: 1 addition & 1 deletion lib/init-action.js.map

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions lib/setup-codeql.js
2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/setup-codeql.test.js
2 changes: 1 addition & 1 deletion lib/setup-codeql.test.js.map
112 changes: 112 additions & 0 deletions lib/tar.js
1 change: 1 addition & 0 deletions lib/tar.js.map
1 change: 1 addition & 0 deletions lib/tools-features.js
2 changes: 1 addition & 1 deletion lib/tools-features.js.map
124 changes: 77 additions & 47 deletions node_modules/.package-lock.json
43 changes: 43 additions & 0 deletions node_modules/@microsoft/eslint-formatter-sarif/README.md
63 changes: 63 additions & 0 deletions node_modules/@microsoft/eslint-formatter-sarif/package.json
298 changes: 298 additions & 0 deletions node_modules/@microsoft/eslint-formatter-sarif/sarif.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions node_modules/@typescript-eslint/eslint-plugin/package.json
4 changes: 2 additions & 2 deletions node_modules/@typescript-eslint/parser/dist/index.d.ts
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/parser/dist/index.d.ts.map
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/parser/dist/index.js.map
8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/parser/dist/parser.d.ts
36 changes: 18 additions & 18 deletions node_modules/@typescript-eslint/parser/dist/parser.js
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/parser/dist/parser.js.map
10 changes: 5 additions & 5 deletions node_modules/@typescript-eslint/parser/package.json
4 changes: 2 additions & 2 deletions node_modules/@typescript-eslint/scope-manager/dist/index.d.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/scope-manager/package.json
8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/type-utils/package.json
722 changes: 361 additions & 361 deletions node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions node_modules/@typescript-eslint/types/dist/lib.d.ts
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/types/dist/lib.d.ts.map
34 changes: 17 additions & 17 deletions node_modules/@typescript-eslint/types/dist/parser-options.d.ts
4 changes: 2 additions & 2 deletions node_modules/@typescript-eslint/types/dist/ts-estree.d.ts
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/types/package.json
32 changes: 16 additions & 16 deletions node_modules/@typescript-eslint/typescript-estree/dist/convert.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions node_modules/@typescript-eslint/utils/dist/index.d.ts
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/utils/dist/index.d.ts.map
15 changes: 5 additions & 10 deletions node_modules/@typescript-eslint/utils/dist/index.js
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/utils/dist/index.js.map
196 changes: 98 additions & 98 deletions node_modules/@typescript-eslint/utils/dist/json-schema.d.ts
18 changes: 9 additions & 9 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/Config.d.ts
10 changes: 5 additions & 5 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/ESLint.js
24 changes: 12 additions & 12 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/Linter.d.ts
32 changes: 16 additions & 16 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/Parser.d.ts
22 changes: 11 additions & 11 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/Processor.d.ts
79 changes: 40 additions & 39 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule.d.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/utils/dist/ts-estree.d.ts
8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/utils/package.json
4 changes: 2 additions & 2 deletions node_modules/@typescript-eslint/visitor-keys/package.json
2 changes: 1 addition & 1 deletion node_modules/adm-zip/headers/entryHeader.js
2 changes: 1 addition & 1 deletion node_modules/adm-zip/package.json
2 changes: 1 addition & 1 deletion node_modules/adm-zip/zipFile.js
23 changes: 23 additions & 0 deletions node_modules/jschardet/.github/workflows/build.yml
38 changes: 38 additions & 0 deletions node_modules/jschardet/.github/workflows/github-release.yml
81 changes: 81 additions & 0 deletions node_modules/jschardet/.github/workflows/npm-publish.yml
4 changes: 4 additions & 0 deletions node_modules/jschardet/CONTRIBUTORS
504 changes: 504 additions & 0 deletions node_modules/jschardet/LICENSE

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions node_modules/jschardet/README.md
7,878 changes: 7,878 additions & 0 deletions node_modules/jschardet/dist/jschardet.js

Large diffs are not rendered by default.

673 changes: 673 additions & 0 deletions node_modules/jschardet/dist/jschardet.min.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions node_modules/jschardet/index.d.ts
1 change: 1 addition & 0 deletions node_modules/jschardet/index.js
34 changes: 34 additions & 0 deletions node_modules/jschardet/package.json
66 changes: 66 additions & 0 deletions node_modules/jschardet/scripts/run-workflow.sh
67 changes: 67 additions & 0 deletions node_modules/jschardet/scripts/show-size-changes.sh
925 changes: 925 additions & 0 deletions node_modules/jschardet/src/big5freq.js

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions node_modules/jschardet/src/big5prober.js
301 changes: 301 additions & 0 deletions node_modules/jschardet/src/chardistribution.js
120 changes: 120 additions & 0 deletions node_modules/jschardet/src/charsetgroupprober.js
99 changes: 99 additions & 0 deletions node_modules/jschardet/src/charsetprober.js
71 changes: 71 additions & 0 deletions node_modules/jschardet/src/codingstatemachine.js
40 changes: 40 additions & 0 deletions node_modules/jschardet/src/constants.js
109 changes: 109 additions & 0 deletions node_modules/jschardet/src/escprober.js
250 changes: 250 additions & 0 deletions node_modules/jschardet/src/escsm.js
107 changes: 107 additions & 0 deletions node_modules/jschardet/src/eucjpprober.js
597 changes: 597 additions & 0 deletions node_modules/jschardet/src/euckrfreq.js

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions node_modules/jschardet/src/euckrprober.js
429 changes: 429 additions & 0 deletions node_modules/jschardet/src/euctwfreq.js

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions node_modules/jschardet/src/euctwprober.js
473 changes: 473 additions & 0 deletions node_modules/jschardet/src/gb2312freq.js

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions node_modules/jschardet/src/gb2312prober.js
323 changes: 323 additions & 0 deletions node_modules/jschardet/src/hebrewprober.js
56 changes: 56 additions & 0 deletions node_modules/jschardet/src/index.js
569 changes: 569 additions & 0 deletions node_modules/jschardet/src/jisfreq.js

Large diffs are not rendered by default.

242 changes: 242 additions & 0 deletions node_modules/jschardet/src/jpcntx.js

Large diffs are not rendered by default.

228 changes: 228 additions & 0 deletions node_modules/jschardet/src/langbulgarianmodel.js
329 changes: 329 additions & 0 deletions node_modules/jschardet/src/langcyrillicmodel.js

Large diffs are not rendered by default.

225 changes: 225 additions & 0 deletions node_modules/jschardet/src/langgreekmodel.js
199 changes: 199 additions & 0 deletions node_modules/jschardet/src/langhebrewmodel.js
225 changes: 225 additions & 0 deletions node_modules/jschardet/src/langhungarianmodel.js
200 changes: 200 additions & 0 deletions node_modules/jschardet/src/langthaimodel.js
167 changes: 167 additions & 0 deletions node_modules/jschardet/src/latin1prober.js
7 changes: 7 additions & 0 deletions node_modules/jschardet/src/logger.js
99 changes: 99 additions & 0 deletions node_modules/jschardet/src/mbcharsetprober.js
58 changes: 58 additions & 0 deletions node_modules/jschardet/src/mbcsgroupprober.js
52 changes: 52 additions & 0 deletions node_modules/jschardet/src/mbcssm/big5.js
54 changes: 54 additions & 0 deletions node_modules/jschardet/src/mbcssm/eucjp.js
51 changes: 51 additions & 0 deletions node_modules/jschardet/src/mbcssm/euckr.js
55 changes: 55 additions & 0 deletions node_modules/jschardet/src/mbcssm/euctw.js
60 changes: 60 additions & 0 deletions node_modules/jschardet/src/mbcssm/gb2312.js
54 changes: 54 additions & 0 deletions node_modules/jschardet/src/mbcssm/sjis.js
56 changes: 56 additions & 0 deletions node_modules/jschardet/src/mbcssm/ucs2be.js
56 changes: 56 additions & 0 deletions node_modules/jschardet/src/mbcssm/ucs2le.js
75 changes: 75 additions & 0 deletions node_modules/jschardet/src/mbcssm/utf8.js
137 changes: 137 additions & 0 deletions node_modules/jschardet/src/sbcharsetprober.js
83 changes: 83 additions & 0 deletions node_modules/jschardet/src/sbcsgroupprober.js
105 changes: 105 additions & 0 deletions node_modules/jschardet/src/sjisprober.js
293 changes: 293 additions & 0 deletions node_modules/jschardet/src/universaldetector.js
108 changes: 108 additions & 0 deletions node_modules/jschardet/src/utf8prober.js
20 changes: 20 additions & 0 deletions node_modules/utf8/LICENSE-MIT.txt
85 changes: 85 additions & 0 deletions node_modules/utf8/README.md
42 changes: 42 additions & 0 deletions node_modules/utf8/package.json
202 changes: 202 additions & 0 deletions node_modules/utf8/utf8.js
133 changes: 82 additions & 51 deletions package-lock.json
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeql",
"version": "3.26.6",
"version": "3.26.7",
"private": true,
"description": "CodeQL action",
"scripts": {
@@ -9,6 +9,7 @@
"test-debug": "ava src/**.test.ts --serial --verbose --timeout=20m",
"lint": "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"removeNPMAbsolutePaths": "removeNPMAbsolutePaths . --force"
},
"ava": {
@@ -34,7 +35,7 @@
"@schemastore/package": "0.0.10",
"@types/node-forge": "^1.3.11",
"@types/uuid": "^10.0.0",
"adm-zip": "^0.5.15",
"adm-zip": "^0.5.16",
"check-disk-space": "^3.4.0",
"console-log-level": "^1.4.1",
"del": "^6.1.1",
@@ -59,15 +60,16 @@
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0",
"@types/adm-zip": "^0.5.5",
"@types/console-log-level": "^1.4.5",
"@types/get-folder-size": "^2.0.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.9.0",
"@types/semver": "^7.5.8",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"ava": "^5.3.1",
"eslint": "^8.57.0",
"eslint-import-resolver-typescript": "^3.6.3",
2 changes: 1 addition & 1 deletion pr-checks/checks/go-tracing-autobuilder.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ env:
steps:
- uses: actions/setup-go@v5
with:
go-version: "~1.22.0"
go-version: "~1.23.0"
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
cache: false
2 changes: 1 addition & 1 deletion pr-checks/checks/go-tracing-custom-build-steps.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ operatingSystems: ["ubuntu", "macos"]
steps:
- uses: actions/setup-go@v5
with:
go-version: "~1.22.0"
go-version: "~1.23.0"
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
cache: false
2 changes: 1 addition & 1 deletion pr-checks/checks/go-tracing-legacy-workflow.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ env:
steps:
- uses: actions/setup-go@v5
with:
go-version: "~1.22.0"
go-version: "~1.23.0"
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
cache: false
30 changes: 30 additions & 0 deletions pr-checks/checks/job-run-uuid-sarif.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Job run UUID added to SARIF"
description: "Tests that the job run UUID is added to the SARIF output"
operatingSystems: ["ubuntu"]
versions: ["nightly-latest"]
steps:
- uses: ./../action/init
id: init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: "${{ runner.temp }}/results"
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: "${{ runner.temp }}/results/javascript.sarif"
retention-days: 7
- name: Check results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
actual=$(jq -r '.runs[0].properties.jobRunUuid' javascript.sarif)
if [[ "$actual" != "$JOB_RUN_UUID" ]]; then
echo "Expected SARIF output to contain job run UUID '$JOB_RUN_UUID', but found '$actual'."
exit 1
else
echo "Found job run UUID '$actual'."
fi
2 changes: 1 addition & 1 deletion pr-checks/checks/test-local-codeql.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ steps:
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ./codeql-bundle-linux64.tar.gz
tools: ./codeql-bundle-linux64.tar.zst
- name: Build code
shell: bash
run: ./build.sh
32 changes: 31 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
@@ -327,6 +327,11 @@ export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
*/
const CODEQL_VERSION_INCLUDE_QUERY_HELP = "2.15.2";

/**
* Versions 2.17.1+ of the CodeQL CLI support the `--cache-cleanup` option.
*/
const CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";

/**
* Set up CodeQL CLI access.
*
@@ -368,6 +373,13 @@ export async function setupCodeQL(
defaultCliVersion,
logger,
);

logger.debug(
`Bundle download status report: ${JSON.stringify(
toolsDownloadStatusReport,
)}`,
);

let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
if (process.platform === "win32") {
codeqlCmd += ".exe";
@@ -858,6 +870,7 @@ export async function getCodeQLForCmd(
)}`,
"--sarif-group-rules-by-pack",
...(await getCodeScanningQueryHelpArguments(this)),
...(await getJobRunUuidSarifOptions(this)),
...getExtraOptionsFromEnv(["database", "interpret-results"]),
];
if (automationDetailsId !== undefined) {
@@ -966,11 +979,17 @@ export async function getCodeQLForCmd(
databasePath: string,
cleanupLevel: string,
): Promise<void> {
const cacheCleanupFlag = (await util.codeQlVersionAtLeast(
this,
CODEQL_VERSION_CACHE_CLEANUP,
))
? "--cache-cleanup"
: "--mode";
const codeqlArgs = [
"database",
"cleanup",
databasePath,
`--mode=${cleanupLevel}`,
`${cacheCleanupFlag}=${cleanupLevel}`,
...getExtraOptionsFromEnv(["database", "cleanup"]),
];
await runTool(cmd, codeqlArgs);
@@ -1405,3 +1424,14 @@ function applyAutobuildAzurePipelinesTimeoutFix() {
"-Dmaven.wagon.http.pool=false",
].join(" ");
}

async function getJobRunUuidSarifOptions(codeql: CodeQL) {
const jobRunUuid = process.env[EnvVar.JOB_RUN_UUID];

return jobRunUuid &&
(await codeql.supportsFeature(
ToolsFeature.DatabaseInterpretResultsSupportsSarifRunProperty,
))
? [`--sarif-run-property=jobRunUuid=${jobRunUuid}`]
: [];
}
8 changes: 4 additions & 4 deletions src/defaults.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bundleVersion": "codeql-bundle-v2.18.3",
"cliVersion": "2.18.3",
"priorBundleVersion": "codeql-bundle-v2.18.2",
"priorCliVersion": "2.18.2"
"bundleVersion": "codeql-bundle-v2.18.4",
"cliVersion": "2.18.4",
"priorBundleVersion": "codeql-bundle-v2.18.3",
"priorCliVersion": "2.18.3"
}
26 changes: 26 additions & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ import {
getActionsStatus,
sendStatusReport,
} from "./status-report";
import { isZstdAvailable } from "./tar";
import { ToolsFeature } from "./tools-features";
import { getTotalCacheSize } from "./trap-caching";
import {
@@ -375,6 +376,8 @@ async function run() {
try {
cleanupDatabaseClusterDirectory(config, logger);

await logZstdAvailability(config, logger);

// Log CodeQL download telemetry, if appropriate
if (toolsDownloadStatusReport) {
addDiagnostic(
@@ -670,6 +673,29 @@ function getTrapCachingEnabled(): boolean {
return true;
}

async function logZstdAvailability(config: configUtils.Config, logger: Logger) {
// Log zstd availability
const zstdAvailableResult = await isZstdAvailable(logger);
addDiagnostic(
config,
// Arbitrarily choose the first language. We could also choose all languages, but that
// increases the risk of misinterpreting the data.
config.languages[0],
makeDiagnostic(
"codeql-action/zstd-availability",
"Zstandard availability",
{
attributes: zstdAvailableResult,
visibility: {
cliSummaryTable: false,
statusPage: false,
telemetry: true,
},
},
),
);
}

async function runWrapper() {
try {
await run();
4 changes: 4 additions & 0 deletions src/setup-codeql.test.ts
Original file line number Diff line number Diff line change
@@ -154,8 +154,10 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
sinon.stub(setupCodeql, "downloadCodeQL").resolves({
codeqlFolder: "codeql",
statusReport: {
compressionMethod: "gzip",
downloadDurationMs: 200,
extractionDurationMs: 300,
toolsUrl: "toolsUrl",
},
toolsVersion: LINKED_CLI_VERSION.cliVersion,
});
@@ -200,8 +202,10 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
sinon.stub(setupCodeql, "downloadCodeQL").resolves({
codeqlFolder: "codeql",
statusReport: {
compressionMethod: "gzip",
downloadDurationMs: 200,
extractionDurationMs: 300,
toolsUrl: bundleUrl,
},
toolsVersion: expectedVersion,
});
51 changes: 34 additions & 17 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ import * as api from "./api-client";
import * as defaults from "./defaults.json";
import { CodeQLDefaultVersionInfo } from "./feature-flags";
import { Logger } from "./logging";
import * as tar from "./tar";
import * as util from "./util";
import { isGoodVersion } from "./util";

@@ -462,8 +463,10 @@ export async function tryGetFallbackToolcacheVersion(
}

export interface ToolsDownloadStatusReport {
compressionMethod: tar.CompressionMethod;
downloadDurationMs: number;
extractionDurationMs: number;
toolsUrl: string;
}

// Exported using `export const` for testing purposes. Specifically, we want to
@@ -505,6 +508,7 @@ export const downloadCodeQL = async function (
`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`,
);

const compressionMethod = tar.inferCompressionMethod(codeqlURL);
const dest = path.join(tempDir, uuidV4());
const finalHeaders = Object.assign(
{ "User-Agent": "CodeQL Action" },
@@ -526,7 +530,10 @@ export const downloadCodeQL = async function (

logger.debug("Extracting CodeQL bundle.");
const extractionStart = performance.now();
const extractedBundlePath = await toolcache.extractTar(archivedBundlePath);
const extractedBundlePath = await tar.extract(
archivedBundlePath,
compressionMethod,
);
const extractionDurationMs = Math.round(performance.now() - extractionStart);
logger.debug(
`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionDurationMs} ms).`,
@@ -544,8 +551,10 @@ export const downloadCodeQL = async function (
return {
codeqlFolder: extractedBundlePath,
statusReport: {
compressionMethod,
downloadDurationMs,
extractionDurationMs,
toolsUrl: sanitizeUrlForStatusReport(codeqlURL),
},
toolsVersion: maybeCliVersion ?? "unknown",
};
@@ -575,8 +584,10 @@ export const downloadCodeQL = async function (
return {
codeqlFolder: toolcachedBundlePath,
statusReport: {
compressionMethod,
downloadDurationMs,
extractionDurationMs,
toolsUrl: sanitizeUrlForStatusReport(codeqlURL),
},
toolsVersion: maybeCliVersion ?? toolcacheVersion,
};
@@ -619,17 +630,16 @@ function getCanonicalToolcacheVersion(
return cliVersion;
}

export interface SetupCodeQLResult {
codeqlFolder: string;
toolsDownloadStatusReport?: ToolsDownloadStatusReport;
toolsSource: ToolsSource;
toolsVersion: string;
}

/**
* Obtains the CodeQL bundle, installs it in the toolcache if appropriate, and extracts it.
*
* @param toolsInput
* @param apiDetails
* @param tempDir
* @param variant
* @param defaultCliVersion
* @param logger
* @param checkVersion Whether to check that CodeQL CLI meets the minimum
* version requirement. Must be set to true outside tests.
* @returns the path to the extracted bundle, and the version of the tools
*/
export async function setupCodeQLBundle(
@@ -639,12 +649,7 @@ export async function setupCodeQLBundle(
variant: util.GitHubVariant,
defaultCliVersion: CodeQLDefaultVersionInfo,
logger: Logger,
): Promise<{
codeqlFolder: string;
toolsDownloadStatusReport?: ToolsDownloadStatusReport;
toolsSource: ToolsSource;
toolsVersion: string;
}> {
): Promise<SetupCodeQLResult> {
const source = await getCodeQLSource(
toolsInput,
defaultCliVersion,
@@ -658,10 +663,14 @@ export async function setupCodeQLBundle(
let toolsDownloadStatusReport: ToolsDownloadStatusReport | undefined;
let toolsSource: ToolsSource;
switch (source.sourceType) {
case "local":
codeqlFolder = await toolcache.extractTar(source.codeqlTarPath);
case "local": {
const compressionMethod = tar.inferCompressionMethod(
source.codeqlTarPath,
);
codeqlFolder = await tar.extract(source.codeqlTarPath, compressionMethod);
toolsSource = ToolsSource.Local;
break;
}
case "toolcache":
codeqlFolder = source.codeqlFolder;
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
@@ -705,3 +714,11 @@ async function cleanUpGlob(glob: string, name: string, logger: Logger) {
logger.warning(`Failed to clean up ${name}: ${e}.`);
}
}

function sanitizeUrlForStatusReport(url: string): string {
return ["github/codeql-action", "dsp-testing/codeql-cli-nightlies"].some(
(repo) => url.startsWith(`https://github.com/${repo}/releases/download/`),
)
? url
: "sanitized-value";
}
103 changes: 103 additions & 0 deletions src/tar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { ToolRunner } from "@actions/exec/lib/toolrunner";
import * as toolcache from "@actions/tool-cache";
import { safeWhich } from "@chrisgavin/safe-which";

import { Logger } from "./logging";
import { assertNever } from "./util";

const MIN_REQUIRED_BSD_TAR_VERSION = "3.4.3";
const MIN_REQUIRED_GNU_TAR_VERSION = "1.31";

export type TarVersion = {
type: "gnu" | "bsd";
version: string;
};

async function getTarVersion(): Promise<TarVersion> {
const tar = await safeWhich("tar");
let stdout = "";
const exitCode = await new ToolRunner(tar, ["--version"], {
listeners: {
stdout: (data: Buffer) => {
stdout += data.toString();
},
},
}).exec();
if (exitCode !== 0) {
throw new Error("Failed to call tar --version");
}
// Return whether this is GNU tar or BSD tar, and the version number
if (stdout.includes("GNU tar")) {
const match = stdout.match(/tar \(GNU tar\) ([0-9.]+)/);
if (!match || !match[1]) {
throw new Error("Failed to parse output of tar --version.");
}

return { type: "gnu", version: match[1] };
} else if (stdout.includes("bsdtar")) {
const match = stdout.match(/bsdtar ([0-9.]+)/);
if (!match || !match[1]) {
throw new Error("Failed to parse output of tar --version.");
}

return { type: "bsd", version: match[1] };
} else {
throw new Error("Unknown tar version");
}
}

export async function isZstdAvailable(
logger: Logger,
): Promise<{ available: boolean; version?: TarVersion }> {
try {
const tarVersion = await getTarVersion();
const { type, version } = tarVersion;
logger.info(`Found ${type} tar version ${version}.`);
switch (type) {
case "gnu":
return {
available: version >= MIN_REQUIRED_GNU_TAR_VERSION,
version: tarVersion,
};
case "bsd":
return {
available: version >= MIN_REQUIRED_BSD_TAR_VERSION,
version: tarVersion,
};
default:
assertNever(type);
}
} catch (e) {
logger.error(
"Failed to determine tar version, therefore will assume zstd may not be available. " +
`The underlying error was: ${e}`,
);
return { available: false };
}
}

export type CompressionMethod = "gzip" | "zstd";

export async function extract(
path: string,
compressionMethod: CompressionMethod,
): Promise<string> {
switch (compressionMethod) {
case "gzip":
// While we could also ask tar to autodetect the compression method,
// we defensively keep the gzip call identical as requesting a gzipped
// bundle will soon be a fallback option.
return await toolcache.extractTar(path);
case "zstd":
// By specifying only the "x" flag, we ask tar to autodetect the
// compression method.
return await toolcache.extractTar(path, undefined, "x");
}
}

export function inferCompressionMethod(path: string): CompressionMethod {
if (path.endsWith(".tar.gz")) {
return "gzip";
}
return "zstd";
}
1 change: 1 addition & 0 deletions src/tools-features.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import type { VersionInfo } from "./codeql";
export enum ToolsFeature {
AnalysisSummaryV2IsDefault = "analysisSummaryV2Default",
BuildModeOption = "buildModeOption",
DatabaseInterpretResultsSupportsSarifRunProperty = "databaseInterpretResultsSupportsSarifRunProperty",
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
InformsAboutUnsupportedPathFilters = "informsAboutUnsupportedPathFilters",
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",