mirror of
https://github.com/github/codeql-action.git
synced 2025-12-07 00:08:06 +08:00
Compare commits
127 Commits
codeql-bun
...
v1.0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59e2f2d80d | ||
|
|
57a865e201 | ||
|
|
dd1c95359b | ||
|
|
fc12036b55 | ||
|
|
fb8602423d | ||
|
|
fa857eb53f | ||
|
|
ecc548b556 | ||
|
|
2f3ec1f9f1 | ||
|
|
554f1b3765 | ||
|
|
934fb86c58 | ||
|
|
e145aa414e | ||
|
|
36f860f369 | ||
|
|
63603427ef | ||
|
|
bf54da2db0 | ||
|
|
592af860c5 | ||
|
|
60211eb74c | ||
|
|
3428407b4d | ||
|
|
d6fc379360 | ||
|
|
11d56696ec | ||
|
|
47cfd760cf | ||
|
|
01b1510da2 | ||
|
|
0afedcafa7 | ||
|
|
84173b94c9 | ||
|
|
8cbe2f5527 | ||
|
|
c302d35e73 | ||
|
|
2a20b15eca | ||
|
|
0d0f0ef80e | ||
|
|
3c8ba71769 | ||
|
|
ae97d8f96d | ||
|
|
14deaf67e9 | ||
|
|
d7dcff944e | ||
|
|
4aa2d05c6b | ||
|
|
d09d89f419 | ||
|
|
f94f1ed663 | ||
|
|
1137e7db3e | ||
|
|
cc14f298d6 | ||
|
|
96edcdfd20 | ||
|
|
b0b9ab80cc | ||
|
|
3b017efdfe | ||
|
|
993205272b | ||
|
|
27e3080228 | ||
|
|
92df23808d | ||
|
|
a10ed6c610 | ||
|
|
500dad96d7 | ||
|
|
aa03f9b023 | ||
|
|
a4a91a8631 | ||
|
|
06c6845442 | ||
|
|
1c26d40826 | ||
|
|
b9217ca238 | ||
|
|
870e8e38d5 | ||
|
|
2c0da4bcc7 | ||
|
|
12f1cff212 | ||
|
|
2ca807cf16 | ||
|
|
1c69fae407 | ||
|
|
67d6f7929f | ||
|
|
028f98f5ea | ||
|
|
c78fb87659 | ||
|
|
45c0f11af2 | ||
|
|
c6728b6769 | ||
|
|
fd614e5792 | ||
|
|
0792832682 | ||
|
|
a607042aab | ||
|
|
35e1b55411 | ||
|
|
66df091046 | ||
|
|
c6b33b9ec1 | ||
|
|
d939c4b8d3 | ||
|
|
68f742b0d4 | ||
|
|
e1cd5244c8 | ||
|
|
57f584a881 | ||
|
|
a05a7f9cb1 | ||
|
|
337ae83a84 | ||
|
|
42babdf2c1 | ||
|
|
c357ca73e4 | ||
|
|
d9050f49a3 | ||
|
|
a7dac5c3db | ||
|
|
53cf5d984d | ||
|
|
93214eca2e | ||
|
|
8f4c2c76ad | ||
|
|
24ef87cfc3 | ||
|
|
954700187b | ||
|
|
4a7cc176ac | ||
|
|
a6891153f0 | ||
|
|
ef852c006a | ||
|
|
1e61ecb0c1 | ||
|
|
8cccc0664b | ||
|
|
3a8e1847c5 | ||
|
|
5c3c29fd3f | ||
|
|
d11b2ce6a3 | ||
|
|
03450ff6ed | ||
|
|
571fe400df | ||
|
|
440ccbd910 | ||
|
|
6017205208 | ||
|
|
7726ece0ab | ||
|
|
7c391e9640 | ||
|
|
67312df7cf | ||
|
|
4087f37d90 | ||
|
|
85ac9fe26e | ||
|
|
40852fa52a | ||
|
|
db80a9a7c3 | ||
|
|
af32a29f03 | ||
|
|
590c245b56 | ||
|
|
a1f71cfecf | ||
|
|
26ade03b50 | ||
|
|
9200db3ec4 | ||
|
|
ac402bf222 | ||
|
|
9f37000f6b | ||
|
|
c5434c91d8 | ||
|
|
e38356b367 | ||
|
|
6e577cfca3 | ||
|
|
68b68732c6 | ||
|
|
7729b51956 | ||
|
|
c98b43187d | ||
|
|
e684c09260 | ||
|
|
1496843315 | ||
|
|
f5a5d3ad5f | ||
|
|
cf6e019480 | ||
|
|
59560e54ac | ||
|
|
476f13ea18 | ||
|
|
a12bb22724 | ||
|
|
d623a7a3f7 | ||
|
|
629f582c03 | ||
|
|
9821b8c68c | ||
|
|
1cd2cd12b4 | ||
|
|
171619a51a | ||
|
|
8d50a5fd90 | ||
|
|
00791d5d56 | ||
|
|
146c897909 |
9
.github/depandabot.yml
vendored
Normal file
9
.github/depandabot.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "thursday" # Gives us a working day to merge this before our typical release
|
||||
labels:
|
||||
- "Update dependencies"
|
||||
2
.github/update-release-branch.py
vendored
2
.github/update-release-branch.py
vendored
@@ -12,6 +12,8 @@ EMPTY_CHANGELOG = """# CodeQL Action and CodeQL Runner Changelog
|
||||
|
||||
## [UNRELEASED]
|
||||
|
||||
No user facing changes.
|
||||
|
||||
"""
|
||||
|
||||
# The branch being merged from.
|
||||
|
||||
2
.github/workflows/post-release-mergeback.yml
vendored
2
.github/workflows/post-release-mergeback.yml
vendored
@@ -101,7 +101,7 @@ jobs:
|
||||
PR_BODY="Updates version and changelog."
|
||||
|
||||
# Update the changelog
|
||||
perl -i -pe 's/^/## \[UNRELEASED\]\n\n/ if($.==3)' CHANGELOG.md
|
||||
perl -i -pe 's/^/## \[UNRELEASED\]\n\nNo user facing changes.\n\n/ if($.==3)' CHANGELOG.md
|
||||
git add .
|
||||
git commit -m "Update changelog and version after $VERSION"
|
||||
npm version patch
|
||||
|
||||
223
.github/workflows/pr-checks.yml
vendored
223
.github/workflows/pr-checks.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
push:
|
||||
branches: [main, v1]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint-js:
|
||||
@@ -26,7 +27,7 @@ jobs:
|
||||
run: .github/workflows/script/check-js.sh
|
||||
|
||||
check-node-modules:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -101,7 +102,8 @@ jobs:
|
||||
fi
|
||||
|
||||
# Packaging test that runs against a javascript database
|
||||
test-packaging-javascript:
|
||||
# Specifying packs in the config file.
|
||||
test-packaging-javascript-config:
|
||||
needs: [check-js, check-node-modules]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -118,8 +120,48 @@ jobs:
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging.yml"
|
||||
languages: javascript
|
||||
# TODO: this can be removed when cli v2.5.6 is released and available in the tool cache
|
||||
tools: https://github.com/dsp-testing/aeisenberg-codeql-action-packaging/releases/download/codeql-bundle-20210615/codeql-bundle-linux64.tar.gz
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Packaging test that runs against a javascript database
|
||||
# Specifying packs as an input.
|
||||
test-packaging-javascript-inputs:
|
||||
needs: [check-js, check-node-modules]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Move codeql-action
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ../action
|
||||
mv * .github ../action/
|
||||
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||
mv ../action/.github/workflows .github
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging2.yml"
|
||||
languages: javascript
|
||||
packs: dsp-testing/codeql-pack1@0.0.4, dsp-testing/codeql-pack2
|
||||
|
||||
- name: Build code
|
||||
shell: bash
|
||||
@@ -143,12 +185,110 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Packaging test that runs against a javascript database
|
||||
# Specifying packs in the config file and inputs.
|
||||
test-packaging-javascript-config-and-inputs:
|
||||
needs: [check-js, check-node-modules]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Move codeql-action
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ../action
|
||||
mv * .github ../action/
|
||||
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||
mv ../action/.github/workflows .github
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging3.yml"
|
||||
packs: +dsp-testing/codeql-pack1@0.0.4
|
||||
languages: javascript
|
||||
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Tests a split workflow where database construction and query execution happen in different steps
|
||||
test-split-workflow:
|
||||
needs: [check-js, check-node-modules]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Move codeql-action
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ../action
|
||||
mv * .github ../action/
|
||||
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||
mv ../action/.github/workflows .github
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging3.yml"
|
||||
packs: +dsp-testing/codeql-pack1@0.0.4
|
||||
languages: javascript
|
||||
tools: latest
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
skip-queries: true
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert No Results
|
||||
run: |
|
||||
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
|
||||
echo "Expected results directory to be empty after skipping query execution!"
|
||||
exit 1
|
||||
fi
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Identify the CodeQL tool versions to integration test against.
|
||||
check-codeql-versions:
|
||||
needs: [check-js, check-node-modules]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions: ${{ steps.compare.outputs.versions }}
|
||||
nightly-url: ${{ steps.get-url.outputs.nightly-url }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -174,22 +314,45 @@ jobs:
|
||||
with:
|
||||
tools: latest
|
||||
languages: javascript
|
||||
- name: Compare default and latest CodeQL bundle versions
|
||||
- name: Remove empty database
|
||||
# allows us to run init a third time
|
||||
run: |
|
||||
rm -rf "$RUNNER_TEMP/codeql_databases"
|
||||
- name: Get nightly release URL
|
||||
id: get-url
|
||||
env:
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
shell: bash
|
||||
# This workflow step gets an unstable testing version of the CodeQL CLI. It should not be used outside of these tests.
|
||||
run: |
|
||||
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
||||
echo "::set-output name=nightly-url::https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz"
|
||||
- name: Init with a CodeQL bundle from a nightly release
|
||||
id: init-nightly
|
||||
uses: ./../action/init
|
||||
with:
|
||||
tools: ${{ steps.get-url.outputs.nightly-url }}
|
||||
languages: javascript
|
||||
- name: Compare CodeQL bundle versions
|
||||
id: compare
|
||||
env:
|
||||
CODEQL_DEFAULT: ${{ steps.init-default.outputs.codeql-path }}
|
||||
CODEQL_LATEST: ${{ steps.init-latest.outputs.codeql-path }}
|
||||
CODEQL_NIGHTLY: ${{ steps.init-nightly.outputs.codeql-path }}
|
||||
NIGHTLY_URL: ${{ steps.get-url.outputs.nightly-url }}
|
||||
run: |
|
||||
CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)"
|
||||
CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)"
|
||||
CODEQL_VERSION_NIGHTLY="$("$CODEQL_NIGHTLY" version --format terse)"
|
||||
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
|
||||
echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
|
||||
echo "Nightly CodeQL bundle version is $CODEQL_VERSION_NIGHTLY"
|
||||
if [[ "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
|
||||
# Just use `tools: null` to avoid duplication in the integration tests.
|
||||
VERSIONS_JSON='[null]'
|
||||
# Skip `tools: latest` since it would be the same as `tools: null`
|
||||
VERSIONS_JSON="[null, \"$NIGHTLY_URL\"]"
|
||||
else
|
||||
# Use both `tools: null` and `tools: latest` in the integration tests.
|
||||
VERSIONS_JSON='[null, "latest"]'
|
||||
# Run integration tests with all three bundles.
|
||||
VERSIONS_JSON="[null, \"$NIGHTLY_URL\", \"latest\"]"
|
||||
fi
|
||||
# Output a JSON-encoded list with the distinct versions to test against.
|
||||
echo "Suggested matrix config for integration tests: $VERSIONS_JSON"
|
||||
@@ -711,3 +874,45 @@ jobs:
|
||||
# Deliberately don't use TEST_MODE here. This is specifically testing
|
||||
# the compatibility with the API.
|
||||
runner/dist/codeql-runner-linux upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||
|
||||
multi-language-repo_test-local-codeql:
|
||||
needs: [check-js, check-node-modules, check-codeql-versions]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Move codeql-action
|
||||
run: |
|
||||
wget ${{ needs.check-codeql-versions.outputs.nightly-url }}
|
||||
mkdir ../action
|
||||
mv * .github ../action/
|
||||
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||
mv ../action/.github/workflows .github
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ../action/codeql-bundle.tar.gz
|
||||
- name: Build code
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
|
||||
test-javascript-source-root:
|
||||
needs: [check-js, check-node-modules]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./init
|
||||
with:
|
||||
languages: javascript
|
||||
source-root: tests/multi-language-repo
|
||||
- uses: ./analyze
|
||||
with:
|
||||
skip-queries: true
|
||||
upload: false
|
||||
- name: Assert database exists
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d javascript ]]; then
|
||||
echo "Did not find a JavaScript database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -7,6 +7,7 @@ if [ ! -z "$(git status --porcelain)" ]; then
|
||||
>&2 echo "Failed: Repo should be clean before testing!"
|
||||
exit 1
|
||||
fi
|
||||
sudo npm install --force -g npm@latest
|
||||
# Reinstall modules and then clean to remove absolute paths
|
||||
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
|
||||
npm ci
|
||||
|
||||
39
.github/workflows/update-dependencies.yml
vendored
Normal file
39
.github/workflows/update-dependencies.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Update dependencies
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, labeled]
|
||||
|
||||
jobs:
|
||||
update:
|
||||
name: Update dependencies
|
||||
runs-on: macos-latest
|
||||
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies')
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Remove PR label
|
||||
env:
|
||||
REPOSITORY: '${{ github.repository }}'
|
||||
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
run: |
|
||||
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
|
||||
|
||||
- name: Push updated dependencies
|
||||
env:
|
||||
BRANCH: '${{ github.head_ref }}'
|
||||
run: |
|
||||
git fetch
|
||||
git checkout $BRANCH
|
||||
sudo npm install --force -g npm@latest
|
||||
npm install
|
||||
npm ci
|
||||
npm run removeNPMAbsolutePaths
|
||||
if [ ! -z "$(git status --porcelain)" ]; then
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git add node_modules
|
||||
git commit -am "Update checked-in dependencies"
|
||||
git push origin "$BRANCH"
|
||||
fi
|
||||
27
CHANGELOG.md
27
CHANGELOG.md
@@ -1,6 +1,31 @@
|
||||
# CodeQL Action and CodeQL Runner Changelog
|
||||
|
||||
## [UNRELEASED]
|
||||
## 1.0.8 - 26 Jul 2021
|
||||
|
||||
- Update default CodeQL bundle version to 2.5.8. [#631](https://github.com/github/codeql-action/pull/631)
|
||||
|
||||
## 1.0.7 - 21 Jul 2021
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 1.0.6 - 19 Jul 2021
|
||||
|
||||
- The `init` step of the Action now supports a `source-root` input as a path to the root source-code directory. By default, the path is relative to `$GITHUB_WORKSPACE`. [#607](https://github.com/github/codeql-action/pull/607)
|
||||
- The `init` step will now try to install a few Python tools needed by this Action when running on a self-hosted runner. [#616](https://github.com/github/codeql-action/pull/616)
|
||||
|
||||
## 1.0.5 - 12 Jul 2021
|
||||
|
||||
- The `analyze` step of the Action now supports a `skip-queries` option to merely build the CodeQL database without analyzing. This functionality is not present in the runner. Additionally, the step will no longer fail if it encounters a finalized database, and will instead continue with query execution. [#602](https://github.com/github/codeql-action/pull/602)
|
||||
- Update the warning message when the baseline lines of code count is unavailable. [#608](https://github.com/github/codeql-action/pull/608)
|
||||
|
||||
## 1.0.4 - 28 Jun 2021
|
||||
|
||||
- Fix `RUNNER_TEMP environment variable must be set` when using runner. [#594](https://github.com/github/codeql-action/pull/594)
|
||||
- Fix couting of lines of code for C# projects. [#586](https://github.com/github/codeql-action/pull/586)
|
||||
|
||||
## 1.0.3 - 23 Jun 2021
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 1.0.2 - 17 Jun 2021
|
||||
|
||||
|
||||
10
README.md
10
README.md
@@ -22,7 +22,9 @@ name: "Code Scanning - Action"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
schedule:
|
||||
# ┌───────────── minute (0 - 59)
|
||||
# │ ┌───────────── hour (0 - 23)
|
||||
@@ -128,3 +130,11 @@ By default, this will override any queries specified in a config file. If you wi
|
||||
## Troubleshooting
|
||||
|
||||
Read about [troubleshooting code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning).
|
||||
|
||||
### Note on "missing analysis" message
|
||||
|
||||
The very first time code scanning is run and if it is on a pull request, you will probably get a message mentioning a "missing analysis". This is expected.
|
||||
|
||||
After code scanning has analyzed the code in a pull request, it needs to compare the analysis of the topic branch (the merge commit of the branch you used to create the pull request) with the analysis of the base branch (the branch into which you want to merge the pull request). This allows code scanning to compute which alerts are newly introduced by the pull request, which alerts were already present in the base branch, and whether any existing alerts are fixed by the changes in the pull request. Initially, if you use a pull request to add code scanning to a repository, the base branch has not yet been analyzed, so it's not possible to compute these details. In this case, when you click through from the results check on the pull request you will see the "Missing analysis for base commit SHA-HASH" message.
|
||||
|
||||
For more information and other causes of this message, see [Reasons for the "missing analysis" message](https://docs.github.com/en/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository#reasons-for-the-missing-analysis-message)
|
||||
|
||||
@@ -24,6 +24,10 @@ inputs:
|
||||
description: Specify whether or not to add code snippets to the output sarif file.
|
||||
required: false
|
||||
default: "false"
|
||||
skip-queries:
|
||||
description: If this option is set, the CodeQL database will be built but no queries will be run on it. Thus, no results will be produced.
|
||||
required: false
|
||||
default: "false"
|
||||
threads:
|
||||
description: The number of threads to be used by CodeQL.
|
||||
required: false
|
||||
@@ -34,6 +38,10 @@ inputs:
|
||||
category:
|
||||
description: String used by Code Scanning for matching the analyses
|
||||
required: false
|
||||
upload-database:
|
||||
description: Whether to upload the resulting CodeQL database
|
||||
required: false
|
||||
default: "true"
|
||||
token:
|
||||
default: ${{ github.token }}
|
||||
matrix:
|
||||
|
||||
@@ -22,6 +22,15 @@ inputs:
|
||||
queries:
|
||||
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.
|
||||
required: false
|
||||
packs:
|
||||
description: >-
|
||||
[Experimental] Comma-separated list of packs to run. Reference a pack in the format `scope/name[@version]`. If `version` is not
|
||||
specified, then the latest version of the pack is used. By default, this overrides the same setting in a
|
||||
configuration file; prefix with "+" to use both sets of packs.
|
||||
|
||||
This input is only available in single-language analyses. To use packs in multi-language
|
||||
analyses, you must specify packs in the codeql-config.yml file.
|
||||
required: false
|
||||
external-repository-token:
|
||||
description: A token for fetching external config files and queries if they reside in a private repository.
|
||||
required: false
|
||||
@@ -29,6 +38,9 @@ inputs:
|
||||
description: Try to auto-install your python dependencies
|
||||
required: true
|
||||
default: 'true'
|
||||
source-root:
|
||||
description: Path of the root source code directory, relative to $GITHUB_WORKSPACE.
|
||||
required: false
|
||||
outputs:
|
||||
codeql-path:
|
||||
description: The path of the CodeQL binary used for analysis
|
||||
|
||||
30
lib/actions-util.js
generated
30
lib/actions-util.js
generated
@@ -448,10 +448,6 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
|
||||
return statusReport;
|
||||
}
|
||||
exports.createStatusReportBase = createStatusReportBase;
|
||||
function isHTTPError(arg) {
|
||||
var _a;
|
||||
return ((_a = arg) === null || _a === void 0 ? void 0 : _a.status) !== undefined && Number.isInteger(arg.status);
|
||||
}
|
||||
const GENERIC_403_MSG = "The repo on which this action is running is not opted-in to CodeQL code scanning.";
|
||||
const GENERIC_404_MSG = "Not authorized to used the CodeQL code scanning feature on this repo.";
|
||||
const OUT_OF_DATE_MSG = "CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action.";
|
||||
@@ -481,7 +477,7 @@ async function sendStatusReport(statusReport) {
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
if (isHTTPError(e)) {
|
||||
if (util_1.isHTTPError(e)) {
|
||||
switch (e.status) {
|
||||
case 403:
|
||||
if (workflowIsTriggeredByPushEvent() && isDependabotActor()) {
|
||||
@@ -540,4 +536,28 @@ function getRelativeScriptPath() {
|
||||
return path.relative(actionsDirectory, __filename);
|
||||
}
|
||||
exports.getRelativeScriptPath = getRelativeScriptPath;
|
||||
// Reads the contents of GITHUB_EVENT_PATH as a JSON object
|
||||
function getWorkflowEvent() {
|
||||
const eventJsonFile = util_1.getRequiredEnvParam("GITHUB_EVENT_PATH");
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(eventJsonFile, "utf-8"));
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Unable to read workflow event JSON from ${eventJsonFile}: ${e}`);
|
||||
}
|
||||
}
|
||||
// Is the version of the repository we are currently analyzing from the default branch,
|
||||
// or alternatively from another branch or a pull request.
|
||||
async function isAnalyzingDefaultBranch() {
|
||||
var _a, _b;
|
||||
// Get the current ref and trim and refs/heads/ prefix
|
||||
let currentRef = await getRef();
|
||||
currentRef = currentRef.startsWith("refs/heads/")
|
||||
? currentRef.substr("refs/heads/".length)
|
||||
: currentRef;
|
||||
const event = getWorkflowEvent();
|
||||
const defaultBranch = (_b = (_a = event) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.default_branch;
|
||||
return currentRef === defaultBranch;
|
||||
}
|
||||
exports.isAnalyzingDefaultBranch = isAnalyzingDefaultBranch;
|
||||
//# sourceMappingURL=actions-util.js.map
|
||||
File diff suppressed because one or more lines are too long
26
lib/actions-util.test.js
generated
26
lib/actions-util.test.js
generated
@@ -1,7 +1,4 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
@@ -9,7 +6,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
const sinon_1 = __importDefault(require("sinon"));
|
||||
@@ -408,4 +410,22 @@ ava_1.default("initializeEnvironment", (t) => {
|
||||
t.deepEqual(util_1.getMode(), util_1.Mode.runner);
|
||||
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "4.5.6");
|
||||
});
|
||||
ava_1.default("isAnalyzingDefaultBranch()", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
const envFile = path.join(tmpDir, "event.json");
|
||||
fs.writeFileSync(envFile, JSON.stringify({
|
||||
repository: {
|
||||
default_branch: "main",
|
||||
},
|
||||
}));
|
||||
process.env["GITHUB_EVENT_PATH"] = envFile;
|
||||
process.env["GITHUB_REF"] = "main";
|
||||
process.env["GITHUB_SHA"] = "1234";
|
||||
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
|
||||
process.env["GITHUB_REF"] = "refs/heads/main";
|
||||
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
|
||||
process.env["GITHUB_REF"] = "feature";
|
||||
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), false);
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=actions-util.test.js.map
|
||||
File diff suppressed because one or more lines are too long
2
lib/analysis-paths.js
generated
2
lib/analysis-paths.js
generated
@@ -9,7 +9,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = __importStar(require("path"));
|
||||
function isInterpretedLanguage(language) {
|
||||
return language === "javascript" || language === "python";
|
||||
return (language === "javascript" || language === "python" || language === "ruby");
|
||||
}
|
||||
// Matches a string containing only characters that are legal to include in paths on windows.
|
||||
exports.legalWindowsPathCharactersRegex = /^[^<>:"|?]*$/;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3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AAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACxD;AACH,CAAC;AArCD,wEAqCC"}
|
||||
36
lib/analyze-action.js
generated
36
lib/analyze-action.js
generated
@@ -13,7 +13,9 @@ const core = __importStar(require("@actions/core"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const analyze_1 = require("./analyze");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const database_upload_1 = require("./database-upload");
|
||||
const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
const upload_lib = __importStar(require("./upload-lib"));
|
||||
const util = __importStar(require("./util"));
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
@@ -32,7 +34,8 @@ async function sendStatusReport(startedAt, stats, error) {
|
||||
}
|
||||
async function run() {
|
||||
const startedAt = new Date();
|
||||
let stats = undefined;
|
||||
let uploadStats = undefined;
|
||||
let runStats = undefined;
|
||||
let config = undefined;
|
||||
util.initializeEnvironment(util.Mode.actions, pkg.version);
|
||||
try {
|
||||
@@ -49,7 +52,11 @@ async function run() {
|
||||
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
};
|
||||
const outputDir = actionsUtil.getRequiredInput("output");
|
||||
const queriesStats = await analyze_1.runAnalyze(outputDir, util.getMemoryFlag(actionsUtil.getOptionalInput("ram")), util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger), actionsUtil.getOptionalInput("category"), config, logger);
|
||||
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger);
|
||||
await analyze_1.runFinalize(outputDir, threads, config, logger);
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
runStats = await analyze_1.runQueries(outputDir, util.getMemoryFlag(actionsUtil.getOptionalInput("ram")), util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);
|
||||
}
|
||||
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
||||
await analyze_1.runCleanup(config, actionsUtil.getOptionalInput("cleanup-level") || "brutal", logger);
|
||||
}
|
||||
@@ -58,22 +65,25 @@ async function run() {
|
||||
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
||||
}
|
||||
core.setOutput("db-locations", dbLocations);
|
||||
if (actionsUtil.getRequiredInput("upload") === "true") {
|
||||
const uploadStats = await upload_lib.uploadFromActions(outputDir, config.gitHubVersion, apiDetails, logger);
|
||||
stats = { ...queriesStats, ...uploadStats };
|
||||
if (runStats && actionsUtil.getRequiredInput("upload") === "true") {
|
||||
uploadStats = await upload_lib.uploadFromActions(outputDir, config.gitHubVersion, apiDetails, logger);
|
||||
}
|
||||
else {
|
||||
logger.info("Not uploading results");
|
||||
stats = { ...queriesStats };
|
||||
}
|
||||
const repositoryNwo = repository_1.parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
||||
await database_upload_1.uploadDatabases(repositoryNwo, config, apiDetails, logger);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
console.log(error);
|
||||
if (error instanceof analyze_1.CodeQLAnalysisError) {
|
||||
stats = { ...error.queriesStatusReport };
|
||||
const stats = { ...error.queriesStatusReport };
|
||||
await sendStatusReport(startedAt, stats, error);
|
||||
}
|
||||
else {
|
||||
await sendStatusReport(startedAt, undefined, error);
|
||||
}
|
||||
await sendStatusReport(startedAt, stats, error);
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
@@ -99,7 +109,15 @@ async function run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
await sendStatusReport(startedAt, stats);
|
||||
if (runStats && uploadStats) {
|
||||
await sendStatusReport(startedAt, { ...runStats, ...uploadStats });
|
||||
}
|
||||
else if (runStats) {
|
||||
await sendStatusReport(startedAt, { ...runStats });
|
||||
}
|
||||
else {
|
||||
await sendStatusReport(startedAt, undefined);
|
||||
}
|
||||
}
|
||||
async function runWrapper() {
|
||||
try {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"analyze-action.js","sourceRoot":"","sources":["../src/analyze-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,oDAAsC;AAEtC,4DAA8C;AAC9C,uCAKmB;AACnB,iDAAmD;AACnD,uCAA6C;AAC7C,yDAA2C;AAC3C,6CAA+B;AAE/B,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAUvC,KAAK,UAAU,gBAAgB,CAC7B,SAAe,EACf,KAAuC,EACvC,KAAa;;IAEb,MAAM,MAAM,GACV,OAAA,KAAK,0CAAE,wBAAwB,MAAK,SAAS,IAAI,KAAK,KAAK,SAAS;QAClE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,sBAAsB,CAC/D,QAAQ,EACR,MAAM,EACN,SAAS,QACT,KAAK,0CAAE,OAAO,QACd,KAAK,0CAAE,KAAK,CACb,CAAC;IACF,MAAM,YAAY,GAAuB;QACvC,GAAG,gBAAgB;QACnB,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;KACjB,CAAC;IACF,MAAM,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACnD,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,KAAK,GAAqC,SAAS,CAAC;IACxD,IAAI,MAAM,GAAuB,SAAS,CAAC;IAC3C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,E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E;QACd,IAAI,CAAC,SAAS,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
43
lib/analyze.js
generated
43
lib/analyze.js
generated
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const count_loc_1 = require("./count-loc");
|
||||
@@ -55,7 +56,8 @@ async function createdDBForScannedLanguages(config, logger) {
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
if (languages_1.isScannedLanguage(language)) {
|
||||
if (languages_1.isScannedLanguage(language) &&
|
||||
!dbIsFinalized(config, language, logger)) {
|
||||
logger.startGroup(`Extracting ${language}`);
|
||||
if (language === languages_1.Language.python) {
|
||||
await setupPythonExtractor(logger);
|
||||
@@ -65,13 +67,29 @@ async function createdDBForScannedLanguages(config, logger) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function dbIsFinalized(config, language, logger) {
|
||||
const dbPath = util.getCodeQLDatabasePath(config, language);
|
||||
try {
|
||||
const dbInfo = yaml.load(fs.readFileSync(path.resolve(dbPath, "codeql-database.yml"), "utf8"));
|
||||
return !("inProgress" in dbInfo);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Could not check whether database for ${language} was finalized. Assuming it is not.`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
async function finalizeDatabaseCreation(config, threadsFlag, logger) {
|
||||
await createdDBForScannedLanguages(config, logger);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
logger.startGroup(`Finalizing ${language}`);
|
||||
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag);
|
||||
logger.endGroup();
|
||||
if (dbIsFinalized(config, language, logger)) {
|
||||
logger.info(`There is already a finalized database for ${language} at the location where the CodeQL Action places databases, so we did not create one.`);
|
||||
}
|
||||
else {
|
||||
logger.startGroup(`Finalizing ${language}`);
|
||||
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag);
|
||||
logger.endGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Runs queries and creates sarif files in the given folder
|
||||
@@ -183,15 +201,13 @@ function packWithVersionToQuerySuiteEntry(pack) {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
async function runAnalyze(outputDir, memoryFlag, addSnippetsFlag, threadsFlag, automationDetailsId, config, logger) {
|
||||
async function runFinalize(outputDir, threadsFlag, config, logger) {
|
||||
// Delete the tracer config env var to avoid tracing ourselves
|
||||
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
await finalizeDatabaseCreation(config, threadsFlag, logger);
|
||||
const queriesStats = await runQueries(outputDir, memoryFlag, addSnippetsFlag, threadsFlag, automationDetailsId, config, logger);
|
||||
return { ...queriesStats };
|
||||
}
|
||||
exports.runAnalyze = runAnalyze;
|
||||
exports.runFinalize = runFinalize;
|
||||
async function runCleanup(config, cleanupLevel, logger) {
|
||||
logger.startGroup("Cleaning up databases");
|
||||
for (const language of config.languages) {
|
||||
@@ -203,12 +219,14 @@ async function runCleanup(config, cleanupLevel, logger) {
|
||||
}
|
||||
exports.runCleanup = runCleanup;
|
||||
async function injectLinesOfCode(sarifFile, language, locPromise) {
|
||||
var _a;
|
||||
const lineCounts = await locPromise;
|
||||
const idPrefix = count_loc_1.getIdPrefix(language);
|
||||
if (language in lineCounts) {
|
||||
const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
|
||||
if (Array.isArray(sarif.runs)) {
|
||||
for (const run of sarif.runs) {
|
||||
// Old style: Baseline is inserted when rule ID has suffix /summary/lines-of-code
|
||||
const ruleId = `${idPrefix}/summary/lines-of-code`;
|
||||
run.properties = run.properties || {};
|
||||
run.properties.metricResults = run.properties.metricResults || [];
|
||||
@@ -219,6 +237,15 @@ async function injectLinesOfCode(sarifFile, language, locPromise) {
|
||||
if (rule) {
|
||||
rule.baseline = lineCounts[language];
|
||||
}
|
||||
// New style: Baseline is inserted when matching rule has tag lines-of-code
|
||||
for (const metric of run.properties.metricResults) {
|
||||
if (metric.rule && metric.rule.toolComponent) {
|
||||
const matchingRule = run.tool.extensions[metric.rule.toolComponent.index].rules[metric.rule.index];
|
||||
if ((_a = matchingRule.properties.tags) === null || _a === void 0 ? void 0 : _a.includes("lines-of-code")) {
|
||||
metric.baseline = lineCounts[language];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(sarifFile, JSON.stringify(sarif));
|
||||
|
||||
File diff suppressed because one or more lines are too long
43
lib/analyze.test.js
generated
43
lib/analyze.test.js
generated
@@ -88,6 +88,35 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
||||
],
|
||||
},
|
||||
},
|
||||
// variant 3 references a rule with the lines-of-code tag
|
||||
{
|
||||
tool: {
|
||||
extensions: [
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
properties: {
|
||||
tags: ["lines-of-code"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
rule: {
|
||||
index: 0,
|
||||
toolComponent: {
|
||||
index: 0,
|
||||
},
|
||||
},
|
||||
value: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{},
|
||||
],
|
||||
}));
|
||||
@@ -180,8 +209,20 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
t.deepEqual(sarif.runs[2].properties.metricResults, [
|
||||
{
|
||||
rule: {
|
||||
index: 0,
|
||||
toolComponent: {
|
||||
index: 0,
|
||||
},
|
||||
},
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
// when the rule doesn't exist, it should not be added
|
||||
t.deepEqual(sarif.runs[2].properties.metricResults, []);
|
||||
t.deepEqual(sarif.runs[3].properties.metricResults, []);
|
||||
}
|
||||
function verifyQuerySuites(tmpDir) {
|
||||
const qlsContent = [
|
||||
|
||||
File diff suppressed because one or more lines are too long
142
lib/codeql.js
generated
142
lib/codeql.js
generated
@@ -12,14 +12,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const stream = __importStar(require("stream"));
|
||||
const globalutil = __importStar(require("util"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const http = __importStar(require("@actions/http-client"));
|
||||
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
||||
const query_string_1 = __importDefault(require("query-string"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const uuid_1 = require("uuid");
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api = __importStar(require("./api-client"));
|
||||
const defaults = __importStar(require("./defaults.json")); // Referenced from codeql-action-sync-tool!
|
||||
@@ -27,6 +23,14 @@ const error_matcher_1 = require("./error-matcher");
|
||||
const toolcache = __importStar(require("./toolcache"));
|
||||
const toolrunner_error_catcher_1 = require("./toolrunner-error-catcher");
|
||||
const util = __importStar(require("./util"));
|
||||
class CommandInvocationError extends Error {
|
||||
constructor(cmd, args, exitCode, error) {
|
||||
super(`Failure invoking ${cmd} with arguments ${args}.\n
|
||||
Exit code ${exitCode} and error was:\n
|
||||
${error}`);
|
||||
}
|
||||
}
|
||||
exports.CommandInvocationError = CommandInvocationError;
|
||||
/**
|
||||
* Stores the CodeQL object, and is populated by `setupCodeQL` or `getCodeQL`.
|
||||
* Can be overridden in tests using `setCodeQL`.
|
||||
@@ -51,7 +55,7 @@ function getCodeQLBundleName() {
|
||||
return `codeql-bundle-${platform}.tar.gz`;
|
||||
}
|
||||
function getCodeQLActionRepository(logger) {
|
||||
if (util.isActions()) {
|
||||
if (!util.isActions()) {
|
||||
return CODEQL_DEFAULT_ACTION_REPOSITORY;
|
||||
}
|
||||
else {
|
||||
@@ -142,21 +146,6 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
|
||||
}
|
||||
return `https://github.com/${CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${CODEQL_BUNDLE_VERSION}/${codeQLBundleName}`;
|
||||
}
|
||||
// We have to download CodeQL manually because the toolcache doesn't support Accept headers.
|
||||
// This can be removed once https://github.com/actions/toolkit/pull/530 is merged and released.
|
||||
async function toolcacheDownloadTool(url, headers, tempDir, logger) {
|
||||
const client = new http.HttpClient("CodeQL Action");
|
||||
const dest = path.join(tempDir, uuid_1.v4());
|
||||
const response = await client.get(url, headers);
|
||||
if (response.message.statusCode !== 200) {
|
||||
logger.info(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
throw new Error(`Unexpected HTTP response: ${response.message.statusCode}`);
|
||||
}
|
||||
const pipeline = globalutil.promisify(stream.pipeline);
|
||||
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
||||
await pipeline(response.message, fs.createWriteStream(dest));
|
||||
return dest;
|
||||
}
|
||||
async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) {
|
||||
try {
|
||||
// We use the special value of 'latest' to prioritize the version in the
|
||||
@@ -165,50 +154,58 @@ async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant
|
||||
if (forceLatest) {
|
||||
codeqlURL = undefined;
|
||||
}
|
||||
const codeqlURLVersion = getCodeQLURLVersion(codeqlURL || `/${CODEQL_BUNDLE_VERSION}/`);
|
||||
const codeqlURLSemVer = convertToSemVer(codeqlURLVersion, logger);
|
||||
// If we find the specified version, we always use that.
|
||||
let codeqlFolder = toolcache.find("CodeQL", codeqlURLSemVer, toolCacheDir, logger);
|
||||
// If we don't find the requested version, in some cases we may allow a
|
||||
// different version to save download time if the version hasn't been
|
||||
// specified explicitly (in which case we always honor it).
|
||||
if (!codeqlFolder && !codeqlURL && !forceLatest) {
|
||||
const codeqlVersions = toolcache.findAllVersions("CodeQL", toolCacheDir, logger);
|
||||
if (codeqlVersions.length === 1) {
|
||||
const tmpCodeqlFolder = toolcache.find("CodeQL", codeqlVersions[0], toolCacheDir, logger);
|
||||
if (fs.existsSync(path.join(tmpCodeqlFolder, "pinned-version"))) {
|
||||
logger.debug(`CodeQL in cache overriding the default ${CODEQL_BUNDLE_VERSION}`);
|
||||
codeqlFolder = tmpCodeqlFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (codeqlFolder) {
|
||||
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||
let codeqlFolder;
|
||||
let codeqlURLVersion;
|
||||
if (codeqlURL && !codeqlURL.startsWith("http")) {
|
||||
codeqlFolder = await toolcache.extractTar(codeqlURL, tempDir, logger);
|
||||
codeqlURLVersion = "local";
|
||||
}
|
||||
else {
|
||||
if (!codeqlURL) {
|
||||
codeqlURL = await getCodeQLBundleDownloadURL(apiDetails, variant, logger);
|
||||
codeqlURLVersion = getCodeQLURLVersion(codeqlURL || `/${CODEQL_BUNDLE_VERSION}/`);
|
||||
const codeqlURLSemVer = convertToSemVer(codeqlURLVersion, logger);
|
||||
// If we find the specified version, we always use that.
|
||||
codeqlFolder = toolcache.find("CodeQL", codeqlURLSemVer, toolCacheDir, logger);
|
||||
// If we don't find the requested version, in some cases we may allow a
|
||||
// different version to save download time if the version hasn't been
|
||||
// specified explicitly (in which case we always honor it).
|
||||
if (!codeqlFolder && !codeqlURL && !forceLatest) {
|
||||
const codeqlVersions = toolcache.findAllVersions("CodeQL", toolCacheDir, logger);
|
||||
if (codeqlVersions.length === 1) {
|
||||
const tmpCodeqlFolder = toolcache.find("CodeQL", codeqlVersions[0], toolCacheDir, logger);
|
||||
if (fs.existsSync(path.join(tmpCodeqlFolder, "pinned-version"))) {
|
||||
logger.debug(`CodeQL in cache overriding the default ${CODEQL_BUNDLE_VERSION}`);
|
||||
codeqlFolder = tmpCodeqlFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
const parsedCodeQLURL = new URL(codeqlURL);
|
||||
const parsedQueryString = query_string_1.default.parse(parsedCodeQLURL.search);
|
||||
const headers = { accept: "application/octet-stream" };
|
||||
// We only want to provide an authorization header if we are downloading
|
||||
// from the same GitHub instance the Action is running on.
|
||||
// This avoids leaking Enterprise tokens to dotcom.
|
||||
// We also don't want to send an authorization header if there's already a token provided in the URL.
|
||||
if (codeqlURL.startsWith(`${apiDetails.url}/`) &&
|
||||
parsedQueryString["token"] === undefined) {
|
||||
logger.debug("Downloading CodeQL bundle with token.");
|
||||
headers.authorization = `token ${apiDetails.auth}`;
|
||||
if (codeqlFolder) {
|
||||
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||
}
|
||||
else {
|
||||
logger.debug("Downloading CodeQL bundle without token.");
|
||||
if (!codeqlURL) {
|
||||
codeqlURL = await getCodeQLBundleDownloadURL(apiDetails, variant, logger);
|
||||
}
|
||||
const parsedCodeQLURL = new URL(codeqlURL);
|
||||
const parsedQueryString = query_string_1.default.parse(parsedCodeQLURL.search);
|
||||
const headers = { accept: "application/octet-stream" };
|
||||
// We only want to provide an authorization header if we are downloading
|
||||
// from the same GitHub instance the Action is running on.
|
||||
// This avoids leaking Enterprise tokens to dotcom.
|
||||
// We also don't want to send an authorization header if there's already a token provided in the URL.
|
||||
if (codeqlURL.startsWith(`${apiDetails.url}/`) &&
|
||||
parsedQueryString["token"] === undefined) {
|
||||
logger.debug("Downloading CodeQL bundle with token.");
|
||||
headers.authorization = `token ${apiDetails.auth}`;
|
||||
}
|
||||
else {
|
||||
logger.debug("Downloading CodeQL bundle without token.");
|
||||
}
|
||||
logger.info(`Downloading CodeQL tools from ${codeqlURL}. This may take a while.`);
|
||||
const codeqlPath = await toolcache.downloadTool(codeqlURL, tempDir, headers);
|
||||
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
|
||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath, tempDir, logger);
|
||||
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, "CodeQL", codeqlURLSemVer, toolCacheDir, logger);
|
||||
}
|
||||
logger.info(`Downloading CodeQL tools from ${codeqlURL}. This may take a while.`);
|
||||
const codeqlPath = await toolcacheDownloadTool(codeqlURL, headers, tempDir, logger);
|
||||
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
|
||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath, tempDir, logger);
|
||||
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, "CodeQL", codeqlURLSemVer, toolCacheDir, logger);
|
||||
}
|
||||
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
|
||||
if (process.platform === "win32") {
|
||||
@@ -287,6 +284,7 @@ function setCodeQL(partialCodeql) {
|
||||
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
|
||||
packDownload: resolveFunction(partialCodeql, "packDownload"),
|
||||
databaseCleanup: resolveFunction(partialCodeql, "databaseCleanup"),
|
||||
databaseBundle: resolveFunction(partialCodeql, "databaseBundle"),
|
||||
databaseRunQueries: resolveFunction(partialCodeql, "databaseRunQueries"),
|
||||
databaseInterpretResults: resolveFunction(partialCodeql, "databaseInterpretResults"),
|
||||
};
|
||||
@@ -535,6 +533,15 @@ function getCodeQLForCmd(cmd) {
|
||||
];
|
||||
await runTool(cmd, codeqlArgs);
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
databasePath,
|
||||
`--output=${outputFilePath}`,
|
||||
];
|
||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
};
|
||||
}
|
||||
function packWithVersionToString(pack) {
|
||||
@@ -586,15 +593,32 @@ function getExtraOptions(options, paths, pathInfo) {
|
||||
return all.concat(specific);
|
||||
}
|
||||
exports.getExtraOptions = getExtraOptions;
|
||||
/*
|
||||
* A constant defining the maximum number of characters we will keep from
|
||||
* the programs stderr for logging. This serves two purposes:
|
||||
* (1) It avoids an OOM if a program fails in a way that results it
|
||||
* printing many log lines.
|
||||
* (2) It avoids us hitting the limit of how much data we can send in our
|
||||
* status reports on GitHub.com.
|
||||
*/
|
||||
const maxErrorSize = 20000;
|
||||
async function runTool(cmd, args = []) {
|
||||
let output = "";
|
||||
await new toolrunner.ToolRunner(cmd, args, {
|
||||
let error = "";
|
||||
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
output += data.toString();
|
||||
},
|
||||
stderr: (data) => {
|
||||
const toRead = Math.min(maxErrorSize - error.length, data.length);
|
||||
error += data.toString("utf8", 0, toRead);
|
||||
},
|
||||
},
|
||||
ignoreReturnCode: true,
|
||||
}).exec();
|
||||
if (exitCode !== 0)
|
||||
throw new CommandInvocationError(cmd, args, exitCode, error);
|
||||
return output;
|
||||
}
|
||||
//# sourceMappingURL=codeql.js.map
|
||||
File diff suppressed because one or more lines are too long
4
lib/codeql.test.js
generated
4
lib/codeql.test.js
generated
@@ -192,10 +192,10 @@ ava_1.default("getExtraOptions throws for bad content", (t) => {
|
||||
});
|
||||
ava_1.default("getCodeQLActionRepository", (t) => {
|
||||
const logger = logging_1.getRunnerLogger(true);
|
||||
util_1.initializeEnvironment(util_1.Mode.actions, "1.2.3");
|
||||
util_1.initializeEnvironment(util_1.Mode.runner, "1.2.3");
|
||||
const repoActions = codeql.getCodeQLActionRepository(logger);
|
||||
t.deepEqual(repoActions, "github/codeql-action");
|
||||
util_1.initializeEnvironment(util_1.Mode.runner, "1.2.3");
|
||||
util_1.initializeEnvironment(util_1.Mode.actions, "1.2.3");
|
||||
// isRunningLocalAction() === true
|
||||
delete process.env["GITHUB_ACTION_REPOSITORY"];
|
||||
process.env["RUNNER_TEMP"] = path.dirname(__dirname);
|
||||
|
||||
File diff suppressed because one or more lines are too long
113
lib/config-utils.js
generated
113
lib/config-utils.js
generated
@@ -114,10 +114,10 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, suiteName, c
|
||||
/**
|
||||
* Retrieve the set of queries at localQueryPath and add them to resultMap.
|
||||
*/
|
||||
async function addLocalQueries(codeQL, resultMap, localQueryPath, checkoutPath, configFile) {
|
||||
async function addLocalQueries(codeQL, resultMap, localQueryPath, workspacePath, configFile) {
|
||||
// Resolve the local path against the workspace so that when this is
|
||||
// passed to codeql it resolves to exactly the path we expect it to resolve to.
|
||||
let absoluteQueryPath = path.join(checkoutPath, localQueryPath);
|
||||
let absoluteQueryPath = path.join(workspacePath, localQueryPath);
|
||||
// Check the file exists
|
||||
if (!fs.existsSync(absoluteQueryPath)) {
|
||||
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
|
||||
@@ -125,10 +125,11 @@ async function addLocalQueries(codeQL, resultMap, localQueryPath, checkoutPath,
|
||||
// Call this after checking file exists, because it'll fail if file doesn't exist
|
||||
absoluteQueryPath = fs.realpathSync(absoluteQueryPath);
|
||||
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
||||
if (!(absoluteQueryPath + path.sep).startsWith(fs.realpathSync(checkoutPath) + path.sep)) {
|
||||
if (!(absoluteQueryPath + path.sep).startsWith(fs.realpathSync(workspacePath) + path.sep)) {
|
||||
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
||||
}
|
||||
await runResolveQueries(codeQL, resultMap, [absoluteQueryPath], checkoutPath);
|
||||
const extraSearchPath = workspacePath;
|
||||
await runResolveQueries(codeQL, resultMap, [absoluteQueryPath], extraSearchPath);
|
||||
}
|
||||
/**
|
||||
* Retrieve the set of queries at the referenced remote repo and add them to resultMap.
|
||||
@@ -166,14 +167,14 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetail
|
||||
* local paths starting with './', or references to remote repos, or
|
||||
* a finite set of hardcoded terms for builtin suites.
|
||||
*/
|
||||
async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir, checkoutPath, apiDetails, logger, configFile) {
|
||||
async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir, workspacePath, apiDetails, logger, configFile) {
|
||||
queryUses = queryUses.trim();
|
||||
if (queryUses === "") {
|
||||
throw new Error(getQueryUsesInvalid(configFile));
|
||||
}
|
||||
// Check for the local path case before we start trying to parse the repository name
|
||||
if (queryUses.startsWith("./")) {
|
||||
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), checkoutPath, configFile);
|
||||
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile);
|
||||
return;
|
||||
}
|
||||
// Check for one of the builtin suites
|
||||
@@ -269,7 +270,9 @@ function getPacksInvalid(configFile) {
|
||||
}
|
||||
exports.getPacksInvalid = getPacksInvalid;
|
||||
function getPacksStrInvalid(packStr, configFile) {
|
||||
return getConfigFilePropertyError(configFile, PACKS_PROPERTY, `"${packStr}" is not a valid pack`);
|
||||
return configFile
|
||||
? getConfigFilePropertyError(configFile, PACKS_PROPERTY, `"${packStr}" is not a valid pack`)
|
||||
: `"${packStr}" is not a valid pack`;
|
||||
}
|
||||
exports.getPacksStrInvalid = getPacksStrInvalid;
|
||||
function getLocalPathOutsideOfRepository(configFile, localPath) {
|
||||
@@ -388,12 +391,12 @@ async function getLanguages(codeQL, languagesInput, repository, apiDetails, logg
|
||||
}
|
||||
return parsedLanguages;
|
||||
}
|
||||
async function addQueriesFromWorkflow(codeQL, queriesInput, languages, resultMap, tempDir, checkoutPath, apiDetails, logger) {
|
||||
async function addQueriesFromWorkflow(codeQL, queriesInput, languages, resultMap, tempDir, workspacePath, apiDetails, logger) {
|
||||
queriesInput = queriesInput.trim();
|
||||
// "+" means "don't override config file" - see shouldAddConfigFileQueries
|
||||
queriesInput = queriesInput.replace(/^\+/, "");
|
||||
for (const query of queriesInput.split(",")) {
|
||||
await parseQueryUses(languages, codeQL, resultMap, query, tempDir, checkoutPath, apiDetails, logger);
|
||||
await parseQueryUses(languages, codeQL, resultMap, query, tempDir, workspacePath, apiDetails, logger);
|
||||
}
|
||||
}
|
||||
// Returns true if either no queries were provided in the workflow.
|
||||
@@ -409,7 +412,8 @@ function shouldAddConfigFileQueries(queriesInput) {
|
||||
/**
|
||||
* Get the default config for when the user has not supplied one.
|
||||
*/
|
||||
async function getDefaultConfig(languagesInput, queriesInput, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger) {
|
||||
async function getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
var _a;
|
||||
const languages = await getLanguages(codeQL, languagesInput, repository, apiDetails, logger);
|
||||
const queries = {};
|
||||
for (const language of languages) {
|
||||
@@ -420,14 +424,15 @@ async function getDefaultConfig(languagesInput, queriesInput, dbLocation, reposi
|
||||
}
|
||||
await addDefaultQueries(codeQL, languages, queries);
|
||||
if (queriesInput) {
|
||||
await addQueriesFromWorkflow(codeQL, queriesInput, languages, queries, tempDir, checkoutPath, apiDetails, logger);
|
||||
await addQueriesFromWorkflow(codeQL, queriesInput, languages, queries, tempDir, workspacePath, apiDetails, logger);
|
||||
}
|
||||
const packs = (_a = parsePacksFromInput(packsInput, languages), (_a !== null && _a !== void 0 ? _a : {}));
|
||||
return {
|
||||
languages,
|
||||
queries,
|
||||
pathsIgnore: [],
|
||||
paths: [],
|
||||
packs: {},
|
||||
packs,
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
toolCacheDir,
|
||||
@@ -440,13 +445,13 @@ exports.getDefaultConfig = getDefaultConfig;
|
||||
/**
|
||||
* Load the config from the given file.
|
||||
*/
|
||||
async function loadConfig(languagesInput, queriesInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger) {
|
||||
async function loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
var _a;
|
||||
let parsedYAML;
|
||||
if (isLocal(configFile)) {
|
||||
// Treat the config file as relative to the workspace
|
||||
configFile = path.resolve(checkoutPath, configFile);
|
||||
parsedYAML = getLocalConfig(configFile, checkoutPath);
|
||||
configFile = path.resolve(workspacePath, configFile);
|
||||
parsedYAML = getLocalConfig(configFile, workspacePath);
|
||||
}
|
||||
else {
|
||||
parsedYAML = await getRemoteConfig(configFile, apiDetails);
|
||||
@@ -486,7 +491,7 @@ async function loadConfig(languagesInput, queriesInput, configFile, dbLocation,
|
||||
// unless they're prefixed with "+", in which case they supplement those
|
||||
// in the config file.
|
||||
if (queriesInput) {
|
||||
await addQueriesFromWorkflow(codeQL, queriesInput, languages, queries, tempDir, checkoutPath, apiDetails, logger);
|
||||
await addQueriesFromWorkflow(codeQL, queriesInput, languages, queries, tempDir, workspacePath, apiDetails, logger);
|
||||
}
|
||||
if (shouldAddConfigFileQueries(queriesInput) &&
|
||||
QUERIES_PROPERTY in parsedYAML) {
|
||||
@@ -499,7 +504,7 @@ async function loadConfig(languagesInput, queriesInput, configFile, dbLocation,
|
||||
typeof query[QUERIES_USES_PROPERTY] !== "string") {
|
||||
throw new Error(getQueryUsesInvalid(configFile));
|
||||
}
|
||||
await parseQueryUses(languages, codeQL, queries, query[QUERIES_USES_PROPERTY], tempDir, checkoutPath, apiDetails, logger, configFile);
|
||||
await parseQueryUses(languages, codeQL, queries, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, logger, configFile);
|
||||
}
|
||||
}
|
||||
if (PATHS_IGNORE_PROPERTY in parsedYAML) {
|
||||
@@ -524,7 +529,7 @@ async function loadConfig(languagesInput, queriesInput, configFile, dbLocation,
|
||||
paths.push(validateAndSanitisePath(includePath, PATHS_PROPERTY, configFile, logger));
|
||||
}
|
||||
}
|
||||
const packs = parsePacks((_a = parsedYAML[PACKS_PROPERTY], (_a !== null && _a !== void 0 ? _a : {})), languages, configFile);
|
||||
const packs = parsePacks((_a = parsedYAML[PACKS_PROPERTY], (_a !== null && _a !== void 0 ? _a : {})), packsInput, languages, configFile);
|
||||
return {
|
||||
languages,
|
||||
queries,
|
||||
@@ -550,7 +555,7 @@ const PACK_IDENTIFIER_PATTERN = (function () {
|
||||
return new RegExp(`^${component}/${component}$`);
|
||||
})();
|
||||
// Exported for testing
|
||||
function parsePacks(packsByLanguage, languages, configFile) {
|
||||
function parsePacksFromConfig(packsByLanguage, languages, configFile) {
|
||||
const packs = {};
|
||||
if (Array.isArray(packsByLanguage)) {
|
||||
if (languages.length === 1) {
|
||||
@@ -579,12 +584,37 @@ function parsePacks(packsByLanguage, languages, configFile) {
|
||||
}
|
||||
return packs;
|
||||
}
|
||||
exports.parsePacks = parsePacks;
|
||||
exports.parsePacksFromConfig = parsePacksFromConfig;
|
||||
function parsePacksFromInput(packsInput, languages) {
|
||||
var _a;
|
||||
if (!((_a = packsInput) === null || _a === void 0 ? void 0 : _a.trim())) {
|
||||
return undefined;
|
||||
}
|
||||
if (languages.length > 1) {
|
||||
throw new Error("Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language.");
|
||||
}
|
||||
else if (languages.length === 0) {
|
||||
throw new Error("No languages specified. Cannot process the packs input.");
|
||||
}
|
||||
packsInput = packsInput.trim();
|
||||
if (packsInput.startsWith("+")) {
|
||||
packsInput = packsInput.substring(1).trim();
|
||||
if (!packsInput) {
|
||||
throw new Error("A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs.");
|
||||
}
|
||||
}
|
||||
return {
|
||||
[languages[0]]: packsInput.split(",").reduce((packs, pack) => {
|
||||
packs.push(toPackWithVersion(pack, ""));
|
||||
return packs;
|
||||
}, []),
|
||||
};
|
||||
}
|
||||
function toPackWithVersion(packStr, configFile) {
|
||||
if (typeof packStr !== "string") {
|
||||
throw new Error(getPacksStrInvalid(packStr, configFile));
|
||||
}
|
||||
const nameWithVersion = packStr.split("@");
|
||||
const nameWithVersion = packStr.trim().split("@");
|
||||
let version;
|
||||
if (nameWithVersion.length > 2 ||
|
||||
!PACK_IDENTIFIER_PATTERN.test(nameWithVersion[0])) {
|
||||
@@ -597,10 +627,39 @@ function toPackWithVersion(packStr, configFile) {
|
||||
}
|
||||
}
|
||||
return {
|
||||
packName: nameWithVersion[0],
|
||||
packName: nameWithVersion[0].trim(),
|
||||
version,
|
||||
};
|
||||
}
|
||||
// exported for testing
|
||||
function parsePacks(rawPacksFromConfig, rawPacksInput, languages, configFile) {
|
||||
const packsFromInput = parsePacksFromInput(rawPacksInput, languages);
|
||||
const packsFomConfig = parsePacksFromConfig(rawPacksFromConfig, languages, configFile);
|
||||
if (!packsFromInput) {
|
||||
return packsFomConfig;
|
||||
}
|
||||
if (!shouldCombinePacks(rawPacksInput)) {
|
||||
return packsFromInput;
|
||||
}
|
||||
return combinePacks(packsFromInput, packsFomConfig);
|
||||
}
|
||||
exports.parsePacks = parsePacks;
|
||||
function shouldCombinePacks(packsInput) {
|
||||
var _a;
|
||||
return !!((_a = packsInput) === null || _a === void 0 ? void 0 : _a.trim().startsWith("+"));
|
||||
}
|
||||
function combinePacks(packs1, packs2) {
|
||||
const packs = {};
|
||||
for (const lang of Object.keys(packs1)) {
|
||||
packs[lang] = packs1[lang].concat(packs2[lang] || []);
|
||||
}
|
||||
for (const lang of Object.keys(packs2)) {
|
||||
if (!packs[lang]) {
|
||||
packs[lang] = packs2[lang];
|
||||
}
|
||||
}
|
||||
return packs;
|
||||
}
|
||||
function dbLocationOrDefault(dbLocation, tempDir) {
|
||||
return dbLocation || path.resolve(tempDir, "codeql_databases");
|
||||
}
|
||||
@@ -610,16 +669,16 @@ function dbLocationOrDefault(dbLocation, tempDir) {
|
||||
* This will parse the config from the user input if present, or generate
|
||||
* a default config. The parsed config is then stored to a known location.
|
||||
*/
|
||||
async function initConfig(languagesInput, queriesInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger) {
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
var _a, _b, _c;
|
||||
let config;
|
||||
// If no config file was provided create an empty one
|
||||
if (!configFile) {
|
||||
logger.debug("No configuration file was provided");
|
||||
config = await getDefaultConfig(languagesInput, queriesInput, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger);
|
||||
config = await getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger);
|
||||
}
|
||||
else {
|
||||
config = await loadConfig(languagesInput, queriesInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger);
|
||||
config = await loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger);
|
||||
}
|
||||
// The list of queries should not be empty for any language. If it is then
|
||||
// it is a user configuration error.
|
||||
@@ -644,9 +703,9 @@ function isLocal(configPath) {
|
||||
}
|
||||
return configPath.indexOf("@") === -1;
|
||||
}
|
||||
function getLocalConfig(configFile, checkoutPath) {
|
||||
function getLocalConfig(configFile, workspacePath) {
|
||||
// Error if the config file is now outside of the workspace
|
||||
if (!(configFile + path.sep).startsWith(checkoutPath + path.sep)) {
|
||||
if (!(configFile + path.sep).startsWith(workspacePath + path.sep)) {
|
||||
throw new Error(getConfigFileOutsideWorkspaceErrorMessage(configFile));
|
||||
}
|
||||
// Error if the file does not exist
|
||||
|
||||
File diff suppressed because one or more lines are too long
113
lib/config-utils.test.js
generated
113
lib/config-utils.test.js
generated
@@ -76,8 +76,8 @@ ava_1.default("load empty config", async (t) => {
|
||||
};
|
||||
},
|
||||
});
|
||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
||||
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger));
|
||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
||||
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger));
|
||||
});
|
||||
});
|
||||
ava_1.default("loading config saves config", async (t) => {
|
||||
@@ -99,7 +99,7 @@ ava_1.default("loading config saves config", async (t) => {
|
||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
||||
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
||||
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
||||
// The saved config file should now exist
|
||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||
// And that same newly-initialised config should now be returned by getConfig
|
||||
@@ -110,7 +110,7 @@ ava_1.default("loading config saves config", async (t) => {
|
||||
ava_1.default("load input outside of workspace", async (t) => {
|
||||
return await util.withTmpDir(async (tmpDir) => {
|
||||
try {
|
||||
await configUtils.initConfig(undefined, undefined, "../input", undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(undefined, undefined, undefined, "../input", undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -123,7 +123,7 @@ ava_1.default("load non-local input with invalid repo syntax", async (t) => {
|
||||
// no filename given, just a repo
|
||||
const configFile = "octo-org/codeql-config@main";
|
||||
try {
|
||||
await configUtils.initConfig(undefined, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(undefined, undefined, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -137,7 +137,7 @@ ava_1.default("load non-existent input", async (t) => {
|
||||
const configFile = "input";
|
||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
||||
try {
|
||||
await configUtils.initConfig(languages, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -205,7 +205,7 @@ ava_1.default("load non-empty input", async (t) => {
|
||||
};
|
||||
const languages = "javascript";
|
||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||
const actualConfig = await configUtils.initConfig(languages, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const actualConfig = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Should exactly equal the object we constructed earlier
|
||||
t.deepEqual(actualConfig, expectedConfig);
|
||||
});
|
||||
@@ -241,7 +241,7 @@ ava_1.default("Default queries are used", async (t) => {
|
||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||
const languages = "javascript";
|
||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||
await configUtils.initConfig(languages, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Check resolve queries was called correctly
|
||||
t.deepEqual(resolveQueriesArgs.length, 1);
|
||||
t.deepEqual(resolveQueriesArgs[0].queries, [
|
||||
@@ -284,7 +284,7 @@ ava_1.default("Queries can be specified in config file", async (t) => {
|
||||
},
|
||||
});
|
||||
const languages = "javascript";
|
||||
const config = await configUtils.initConfig(languages, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const config = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Check resolveQueries was called correctly
|
||||
// It'll be called once for the default queries
|
||||
// and once for `./foo` from the config file.
|
||||
@@ -317,7 +317,7 @@ ava_1.default("Queries from config file can be overridden in workflow file", asy
|
||||
},
|
||||
});
|
||||
const languages = "javascript";
|
||||
const config = await configUtils.initConfig(languages, testQueries, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Check resolveQueries was called correctly
|
||||
// It'll be called once for the default queries and once for `./override`,
|
||||
// but won't be called for './foo' from the config file.
|
||||
@@ -349,7 +349,7 @@ ava_1.default("Queries in workflow file can be used in tandem with the 'disable
|
||||
},
|
||||
});
|
||||
const languages = "javascript";
|
||||
const config = await configUtils.initConfig(languages, testQueries, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Check resolveQueries was called correctly
|
||||
// It'll be called once for `./workflow-query`,
|
||||
// but won't be called for the default one since that was disabled
|
||||
@@ -375,7 +375,7 @@ ava_1.default("Multiple queries can be specified in workflow file, no config fil
|
||||
},
|
||||
});
|
||||
const languages = "javascript";
|
||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Check resolveQueries was called correctly:
|
||||
// It'll be called once for the default queries,
|
||||
// and then once for each of the two queries from the workflow
|
||||
@@ -414,7 +414,7 @@ ava_1.default("Queries in workflow file can be added to the set of queries witho
|
||||
},
|
||||
});
|
||||
const languages = "javascript";
|
||||
const config = await configUtils.initConfig(languages, testQueries, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
// Check resolveQueries was called correctly
|
||||
// It'll be called once for the default queries,
|
||||
// once for each of additional1 and additional2,
|
||||
@@ -453,7 +453,7 @@ ava_1.default("Invalid queries in workflow file handled correctly", async (t) =>
|
||||
},
|
||||
});
|
||||
try {
|
||||
await configUtils.initConfig(languages, queries, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(languages, queries, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
t.fail("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -496,7 +496,7 @@ ava_1.default("API client used when reading remote config", async (t) => {
|
||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||
const languages = "javascript";
|
||||
await configUtils.initConfig(languages, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
t.assert(spyGetContents.called);
|
||||
});
|
||||
});
|
||||
@@ -506,7 +506,7 @@ ava_1.default("Remote config handles the case where a directory is provided", as
|
||||
mockGetContents(dummyResponse);
|
||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||
try {
|
||||
await configUtils.initConfig(undefined, undefined, repoReference, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -522,7 +522,7 @@ ava_1.default("Invalid format of remote config handled correctly", async (t) =>
|
||||
mockGetContents(dummyResponse);
|
||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||
try {
|
||||
await configUtils.initConfig(undefined, undefined, repoReference, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -539,7 +539,7 @@ ava_1.default("No detected languages", async (t) => {
|
||||
},
|
||||
});
|
||||
try {
|
||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -551,7 +551,7 @@ ava_1.default("Unknown languages", async (t) => {
|
||||
return await util.withTmpDir(async (tmpDir) => {
|
||||
const languages = "rubbish,english";
|
||||
try {
|
||||
await configUtils.initConfig(languages, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeql_1.getCachedCodeQL(), tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -579,7 +579,7 @@ ava_1.default("Config specifies packages", async (t) => {
|
||||
const configFile = path.join(tmpDir, "codeql-config.yaml");
|
||||
fs.writeFileSync(configFile, inputFileContents);
|
||||
const languages = "javascript";
|
||||
const { packs } = await configUtils.initConfig(languages, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const { packs } = await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
t.deepEqual(packs, {
|
||||
[languages_1.Language.javascript]: [
|
||||
{
|
||||
@@ -618,7 +618,7 @@ ava_1.default("Config specifies packages for multiple languages", async (t) => {
|
||||
fs.writeFileSync(configFile, inputFileContents);
|
||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||
const languages = "javascript,python,cpp";
|
||||
const { packs, queries } = await configUtils.initConfig(languages, undefined, configFile, undefined, { owner: "github", repo: "example" }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
const { packs, queries } = await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, { owner: "github", repo: "example" }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
t.deepEqual(packs, {
|
||||
[languages_1.Language.javascript]: [
|
||||
{
|
||||
@@ -671,7 +671,7 @@ function doInvalidInputTest(testName, inputFileContents, expectedErrorMessageGen
|
||||
const inputFile = path.join(tmpDir, configFile);
|
||||
fs.writeFileSync(inputFile, inputFileContents, "utf8");
|
||||
try {
|
||||
await configUtils.initConfig(languages, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logging_1.getRunnerLogger(true));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -745,7 +745,7 @@ ava_1.default("path sanitisation", (t) => {
|
||||
* Test macro for ensuring the packs block is valid
|
||||
*/
|
||||
function parsePacksMacro(t, packsByLanguage, languages, expected) {
|
||||
t.deepEqual(configUtils.parsePacks(packsByLanguage, languages, "/a/b"), expected);
|
||||
t.deepEqual(configUtils.parsePacksFromConfig(packsByLanguage, languages, "/a/b"), expected);
|
||||
}
|
||||
parsePacksMacro.title = (providedTitle) => `Parse Packs: ${providedTitle}`;
|
||||
/**
|
||||
@@ -753,12 +753,15 @@ parsePacksMacro.title = (providedTitle) => `Parse Packs: ${providedTitle}`;
|
||||
*/
|
||||
function parsePacksErrorMacro(t, packsByLanguage, languages, expected) {
|
||||
t.throws(() => {
|
||||
configUtils.parsePacks(packsByLanguage, languages, "/a/b");
|
||||
configUtils.parsePacksFromConfig(packsByLanguage, languages, "/a/b");
|
||||
}, {
|
||||
message: expected,
|
||||
});
|
||||
}
|
||||
parsePacksErrorMacro.title = (providedTitle) => `Parse Packs Error: ${providedTitle}`;
|
||||
/**
|
||||
* Test macro for testing when the packs block is invalid
|
||||
*/
|
||||
function invalidPackNameMacro(t, name) {
|
||||
parsePacksErrorMacro(t, { [languages_1.Language.cpp]: [name] }, [languages_1.Language.cpp], new RegExp(`The configuration file "/a/b" is invalid: property "packs" "${name}" is not a valid pack`));
|
||||
}
|
||||
@@ -770,6 +773,12 @@ ava_1.default("two packs", parsePacksMacro, ["a/b", "c/d@1.2.3"], [languages_1.L
|
||||
{ packName: "c/d", version: semver_1.clean("1.2.3") },
|
||||
],
|
||||
});
|
||||
ava_1.default("two packs with spaces", parsePacksMacro, [" a/b ", " c/d@1.2.3 "], [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [
|
||||
{ packName: "a/b", version: undefined },
|
||||
{ packName: "c/d", version: semver_1.clean("1.2.3") },
|
||||
],
|
||||
});
|
||||
ava_1.default("two packs with language", parsePacksMacro, {
|
||||
[languages_1.Language.cpp]: ["a/b", "c/d@1.2.3"],
|
||||
[languages_1.Language.java]: ["d/e", "f/g@1.2.3"],
|
||||
@@ -791,4 +800,60 @@ ava_1.default(invalidPackNameMacro, "c-/d");
|
||||
ava_1.default(invalidPackNameMacro, "-c/d");
|
||||
ava_1.default(invalidPackNameMacro, "c/d_d");
|
||||
ava_1.default(invalidPackNameMacro, "c/d@x");
|
||||
/**
|
||||
* Test macro for testing the packs block and the packs input
|
||||
*/
|
||||
function parseInputAndConfigMacro(t, packsFromConfig, packsFromInput, languages, expected) {
|
||||
t.deepEqual(configUtils.parsePacks(packsFromConfig, packsFromInput, languages, "/a/b"), expected);
|
||||
}
|
||||
parseInputAndConfigMacro.title = (providedTitle) => `Parse Packs input and config: ${providedTitle}`;
|
||||
function parseInputAndConfigErrorMacro(t, packsFromConfig, packsFromInput, languages, expected) {
|
||||
t.throws(() => {
|
||||
configUtils.parsePacks(packsFromConfig, packsFromInput, languages, "/a/b");
|
||||
}, {
|
||||
message: expected,
|
||||
});
|
||||
}
|
||||
parseInputAndConfigErrorMacro.title = (providedTitle) => `Parse Packs input and config Error: ${providedTitle}`;
|
||||
ava_1.default("input only", parseInputAndConfigMacro, {}, " c/d ", [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [{ packName: "c/d", version: undefined }],
|
||||
});
|
||||
ava_1.default("input only with multiple", parseInputAndConfigMacro, {}, "a/b , c/d@1.2.3", [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [
|
||||
{ packName: "a/b", version: undefined },
|
||||
{ packName: "c/d", version: "1.2.3" },
|
||||
],
|
||||
});
|
||||
ava_1.default("input only with +", parseInputAndConfigMacro, {}, " + a/b , c/d@1.2.3 ", [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [
|
||||
{ packName: "a/b", version: undefined },
|
||||
{ packName: "c/d", version: "1.2.3" },
|
||||
],
|
||||
});
|
||||
ava_1.default("config only", parseInputAndConfigMacro, ["a/b", "c/d"], " ", [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [
|
||||
{ packName: "a/b", version: undefined },
|
||||
{ packName: "c/d", version: undefined },
|
||||
],
|
||||
});
|
||||
ava_1.default("input overrides", parseInputAndConfigMacro, ["a/b", "c/d"], " e/f, g/h@1.2.3 ", [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [
|
||||
{ packName: "e/f", version: undefined },
|
||||
{ packName: "g/h", version: "1.2.3" },
|
||||
],
|
||||
});
|
||||
ava_1.default("input and config", parseInputAndConfigMacro, ["a/b", "c/d"], " +e/f, g/h@1.2.3 ", [languages_1.Language.cpp], {
|
||||
[languages_1.Language.cpp]: [
|
||||
{ packName: "e/f", version: undefined },
|
||||
{ packName: "g/h", version: "1.2.3" },
|
||||
{ packName: "a/b", version: undefined },
|
||||
{ packName: "c/d", version: undefined },
|
||||
],
|
||||
});
|
||||
ava_1.default("input with no language", parseInputAndConfigErrorMacro, {}, "c/d", [], /No languages specified/);
|
||||
ava_1.default("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], /multi-language analysis/);
|
||||
ava_1.default("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], /remove the '\+'/);
|
||||
ava_1.default("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], /"xxx" is not a valid pack/);
|
||||
// errors
|
||||
// input w invalid pack name
|
||||
//# sourceMappingURL=config-utils.test.js.map
|
||||
File diff suppressed because one or more lines are too long
15
lib/count-loc.js
generated
15
lib/count-loc.js
generated
@@ -77,14 +77,13 @@ async function countLoc(cwd, include, exclude, dbLanguages, logger) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.info("Could not determine the total number of lines of code in this repository. " +
|
||||
"Because of this, it will not be possible to compare the number of lines " +
|
||||
"of code analyzed by code scanning with the total number of lines of " +
|
||||
"code in the repository. This will not affect the results produced by code " +
|
||||
"scanning. If you have any questions, you can raise an issue at " +
|
||||
"https://github.com/github/codeql-action/issues. Please include a link " +
|
||||
"to the repository if public, or otherwise information about the code scanning " +
|
||||
"workflow you are using.");
|
||||
logger.info("Could not determine the baseline lines of code count in this repository. " +
|
||||
"Because of this, it will not be possible to compare the lines " +
|
||||
"of code analyzed by code scanning with the baseline. This will not affect " +
|
||||
"the results produced by code scanning. If you have any questions, you can " +
|
||||
"raise an issue at https://github.com/github/codeql-action/issues. Please " +
|
||||
"include a link to the repository if public, or otherwise information about " +
|
||||
"the code scanning workflow you are using.");
|
||||
}
|
||||
return lineCounts;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"count-loc.js","sourceRoot":"","sources":["../src/count-loc.ts"],"names":[],"mappings":";;AAAA,qDAAyC;AAEzC,2CAAuC;AAEvC,iCAAqC;AAKrC,sFAAsF;AACtF,MAAM,iBAAiB,GAA6B;IAClD,CAAC,EAAE,oBAAQ,CAAC,GAAG;IACf,KAAK,EAAE,oBAAQ,CAAC,GAAG;IACnB,IAAI,EAAE,oBAAQ,CAAC,MAAM;IACrB,EAAE,EAAE,oBAAQ,CAAC,EAAE;IACf,IAAI,EAAE,oBAAQ,CAAC,IAAI;IACnB,UAAU,EAAE,oBAAQ,CAAC,UAAU;IAC/B,MAAM,EAAE,oBAAQ,CAAC,MAAM;IACvB,IAAI,EAAE,oBAAQ,CAAC,IAAI;IACnB,UAAU,EAAE,oBAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAC7D,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;IACnB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACd,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;KAChB;IACD,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,GAAG,CAAC;AACb,CAAC,EACD,EAAgC,CACjC,CAAC;AAEF,SAAgB,WAAW,CAAC,QAAkB;IAC5C,QAAQ,QAAQ,EAAE;QAChB,KAAK,oBAAQ,CAAC,GAAG;YACf,OAAO,KAAK,CAAC;QACf,KAAK,oBAAQ,CAAC,MAAM;YAClB,OAAO,IAAI,CAAC;QACd,KAAK,oBAAQ,CAAC,EAAE;YACd,OAAO,IAAI,CAA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uD;IACvD,2DAA2D;IAC3D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CACxD,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;QAC5B,MAAM,eAAe,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,eAAe,IAAI,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAC5D,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3D;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA8B,CAC/B,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACrC,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC1D,MAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;SACzC;KACF;SAAM;QACL,MAAM,CAAC,IAAI,CACT,2EAA2E;YACzE,gEAAgE;YAChE,4EAA4E;YAC5E,4EAA4E;YAC5E,2EAA2E;YAC3E,6EAA6E;YAC7E,2CAA2C,CAC9C,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA9CD,4BA8CC"}
|
||||
6
lib/count-loc.test.js
generated
6
lib/count-loc.test.js
generated
@@ -24,6 +24,12 @@ ava_1.default("ensure lines of code works for cpp and js", async (t) => {
|
||||
javascript: 9,
|
||||
});
|
||||
});
|
||||
ava_1.default("ensure lines of code works for csharp", async (t) => {
|
||||
const results = await count_loc_1.countLoc(path.join(__dirname, "../tests/multi-language-repo"), [], [], [languages_1.Language.csharp], logging_1.getRunnerLogger(true));
|
||||
t.deepEqual(results, {
|
||||
csharp: 10,
|
||||
});
|
||||
});
|
||||
ava_1.default("ensure lines of code can handle undefined language", async (t) => {
|
||||
const results = await count_loc_1.countLoc(path.join(__dirname, "../tests/multi-language-repo"), [], [], [languages_1.Language.javascript, languages_1.Language.python, "hucairz"], logging_1.getRunnerLogger(true));
|
||||
t.deepEqual(results, {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"count-loc.test.js","sourceRoot":"","sources":["../src/count-loc.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6B;AAE7B,8CAAuB;AAEvB,2CAAuC;AACvC,2CAAuC;AACvC,uCAA4C;AAC5C,mDAA6C;AAE7C,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,2CAA2C,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,MAAM,oBAAQ,CAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EACpD,EAAE,EACF,EAAE,EACF,CAAC,oBAAQ,CAAC,GAAG,EAAE,oBAAQ,CAAC,UAAU,CAAC,EACnC,yBAAe,CAAC,IAAI,CAAC,CACtB,CAAC;IAEF,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE;QACnB,GAAG,EAAE,CAAC;QACN,UAAU,EAAE,CAAC;KACd,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,oDAAoD,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACrE,MAAM,OAAO,GAAG,MAAM,oBAAQ,CAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EACpD,EAAE,EACF,EAAE,EACF,CAAC,oBAAQ,CAAC,UAAU,EAAE,oBAAQ,CAAC,MAAM,EAAE,SAAqB,CAAC,EAC7D,yBAAe,CAAC,IAAI,CAAC,CACtB,CAAC;IAEF,CAAC,CAAC,SA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,IAAI,CAAC,CACtB,CAAC;IAEF,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE;QACnB,UAAU,EAAE,EAAE;KACf,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,gDAAgD,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACjE,gEAAgE;IAChE,4CAA4C;IAC5C,MAAM,OAAO,GAAG,MAAM,oBAAQ,CAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EACpD,CAAC,YAAY,CAAC,EACd,EAAE,EACF,CAAC,oBAAQ,CAAC,UAAU,CAAC,EACrB,yBAAe,CAAC,IAAI,CAAC,CACtB,CAAC;IAEF,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE;IACnB,wBAAwB;KACzB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,yCAAyC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC1D,MAAM,OAAO,GAAG,MAAM,oBAAQ,CAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EACpD,EAAE,EACF,CAAC,SAAS,CAAC,EACX,CAAC,oBAAQ,CAAC,UAAU,EAAE,oBAAQ,CAAC,MAAM,CAAC,EACtC,yBAAe,CAAC,IAAI,CAAC,CACtB,CAAC;IAEF,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE;QACnB,UAAU,EAAE,CAAC;KACd,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
72
lib/database-upload.js
generated
Normal file
72
lib/database-upload.js
generated
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const util = __importStar(require("./util"));
|
||||
async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
||||
if (actionsUtil.getRequiredInput("upload-database") !== "true") {
|
||||
logger.debug("Database upload disabled in workflow. Skipping upload.");
|
||||
return;
|
||||
}
|
||||
// Do nothing when not running against github.com
|
||||
if (config.gitHubVersion.type !== util.GitHubVariant.DOTCOM) {
|
||||
logger.debug("Not running against github.com. Skipping upload.");
|
||||
return;
|
||||
}
|
||||
if (!(await actionsUtil.isAnalyzingDefaultBranch())) {
|
||||
// We only want to upload a database if we are analyzing the default branch.
|
||||
logger.debug("Not analyzing default branch. Skipping upload.");
|
||||
return;
|
||||
}
|
||||
const client = api_client_1.getApiClient(apiDetails);
|
||||
try {
|
||||
await client.request("GET /repos/:owner/:repo/code-scanning/codeql/databases", {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
if (util.isHTTPError(e) && e.status === 404) {
|
||||
logger.debug("Repository is not opted in to database uploads. Skipping upload.");
|
||||
}
|
||||
else {
|
||||
console.log(e);
|
||||
logger.info(`Skipping database upload due to unknown error: ${e}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
// Bundle the database up into a single zip file
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
const databaseBundlePath = `${databasePath}.zip`;
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath);
|
||||
// Upload the database bundle
|
||||
const payload = fs.readFileSync(databaseBundlePath);
|
||||
try {
|
||||
await client.request(`PUT /repos/:owner/:repo/code-scanning/codeql/databases/:language`, {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
data: payload,
|
||||
});
|
||||
logger.debug(`Successfully uploaded database for ${language}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
// Log a warning but don't fail the workflow
|
||||
logger.warning(`Failed to upload database for ${language}: ${e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.uploadDatabases = uploadDatabases;
|
||||
//# sourceMappingURL=database-upload.js.map
|
||||
1
lib/database-upload.js.map
Normal file
1
lib/database-upload.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAExB,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjE,OAAO;KACR;IAED,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,wBAAwB,EAAE,CAAC,EAAE;QACnD,4EAA4E;QAC5E,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,MAAM,MAAM,GAAG,yBAAY,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI;QACF,MAAM,MAAM,CAAC,OAAO,CAClB,wDAAwD,EACxD;YACE,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB,CACF,CAAC;KACH;IAAC,OAAO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file
@@ -0,0 +1,236 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const sinon_1 = __importDefault(require("sinon"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const apiClient = __importStar(require("./api-client"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const database_upload_1 = require("./database-upload");
|
||||
const languages_1 = require("./languages");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const util_1 = require("./util");
|
||||
testing_utils_1.setupTests(ava_1.default);
|
||||
ava_1.default.beforeEach(() => {
|
||||
util_1.initializeEnvironment(util_1.Mode.actions, "1.2.3");
|
||||
});
|
||||
const testRepoName = { owner: "github", repo: "example" };
|
||||
const testApiDetails = {
|
||||
auth: "1234",
|
||||
url: "https://github.com",
|
||||
};
|
||||
function getTestConfig(tmpDir) {
|
||||
return {
|
||||
languages: [languages_1.Language.javascript],
|
||||
queries: {},
|
||||
pathsIgnore: [],
|
||||
paths: [],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
toolCacheDir: tmpDir,
|
||||
codeQLCmd: "foo",
|
||||
gitHubVersion: { type: util_1.GitHubVariant.DOTCOM },
|
||||
dbLocation: tmpDir,
|
||||
packs: {},
|
||||
};
|
||||
}
|
||||
function getRecordingLogger(messages) {
|
||||
return {
|
||||
debug: (message) => {
|
||||
messages.push({ type: "debug", message });
|
||||
console.debug(message);
|
||||
},
|
||||
info: (message) => {
|
||||
messages.push({ type: "info", message });
|
||||
console.info(message);
|
||||
},
|
||||
warning: (message) => {
|
||||
messages.push({ type: "warning", message });
|
||||
console.warn(message);
|
||||
},
|
||||
error: (message) => {
|
||||
messages.push({ type: "error", message });
|
||||
console.error(message);
|
||||
},
|
||||
isDebug: () => true,
|
||||
startGroup: () => undefined,
|
||||
endGroup: () => undefined,
|
||||
};
|
||||
}
|
||||
function mockHttpRequests(optInStatusCode, databaseUploadStatusCode) {
|
||||
// Passing an auth token is required, so we just use a dummy value
|
||||
const client = github.getOctokit("123");
|
||||
const requestSpy = sinon_1.default.stub(client, "request");
|
||||
const optInSpy = requestSpy.withArgs("GET /repos/:owner/:repo/code-scanning/codeql/databases");
|
||||
if (optInStatusCode < 300) {
|
||||
optInSpy.resolves(undefined);
|
||||
}
|
||||
else {
|
||||
optInSpy.throws(new util_1.HTTPError("some error message", optInStatusCode));
|
||||
}
|
||||
if (databaseUploadStatusCode !== undefined) {
|
||||
const databaseUploadSpy = requestSpy.withArgs("PUT /repos/:owner/:repo/code-scanning/codeql/databases/:language");
|
||||
if (databaseUploadStatusCode < 300) {
|
||||
databaseUploadSpy.resolves(undefined);
|
||||
}
|
||||
else {
|
||||
databaseUploadSpy.throws(new util_1.HTTPError("some error message", databaseUploadStatusCode));
|
||||
}
|
||||
}
|
||||
sinon_1.default.stub(apiClient, "getApiClient").value(() => client);
|
||||
}
|
||||
ava_1.default("Abort database upload if 'upload-database' input set to false", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("false");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message === "Database upload disabled in workflow. Skipping upload.") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Abort database upload if running against GHES", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
const config = getTestConfig(tmpDir);
|
||||
config.gitHubVersion = { type: util_1.GitHubVariant.GHES, version: "3.0" };
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, config, testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message === "Not running against github.com. Skipping upload.") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Abort database upload if running against GHAE", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
const config = getTestConfig(tmpDir);
|
||||
config.gitHubVersion = { type: util_1.GitHubVariant.GHAE };
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, config, testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message === "Not running against github.com. Skipping upload.") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Abort database upload if not analyzing default branch", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(false);
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message === "Not analyzing default branch. Skipping upload.") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Abort database upload if opt-in request returns 404", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
mockHttpRequests(404);
|
||||
codeql_1.setCodeQL({
|
||||
async databaseBundle() {
|
||||
return;
|
||||
},
|
||||
});
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message ===
|
||||
"Repository is not opted in to database uploads. Skipping upload.") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Abort database upload if opt-in request fails with something other than 404", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
mockHttpRequests(500);
|
||||
codeql_1.setCodeQL({
|
||||
async databaseBundle() {
|
||||
return;
|
||||
},
|
||||
});
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "info" &&
|
||||
v.message ===
|
||||
"Skipping database upload due to unknown error: Error: some error message") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Don't crash if uploading a database fails", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
mockHttpRequests(204, 500);
|
||||
codeql_1.setCodeQL({
|
||||
async databaseBundle(_, outputFilePath) {
|
||||
fs.writeFileSync(outputFilePath, "");
|
||||
},
|
||||
});
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "warning" &&
|
||||
v.message ===
|
||||
"Failed to upload database for javascript: Error: some error message") !== undefined);
|
||||
});
|
||||
});
|
||||
ava_1.default("Successfully uploading a database", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
testing_utils_1.setupActionsVars(tmpDir, tmpDir);
|
||||
sinon_1.default
|
||||
.stub(actionsUtil, "getRequiredInput")
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
mockHttpRequests(204, 201);
|
||||
codeql_1.setCodeQL({
|
||||
async databaseBundle(_, outputFilePath) {
|
||||
fs.writeFileSync(outputFilePath, "");
|
||||
},
|
||||
});
|
||||
const loggedMessages = [];
|
||||
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message === "Successfully uploaded database for javascript") !== undefined);
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=database-upload.test.js.map
|
||||
1
lib/database-upload.test.js.map
Normal file
1
lib/database-upload.test.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-20210517"
|
||||
"bundleVersion": "codeql-bundle-20210726"
|
||||
}
|
||||
|
||||
8
lib/fingerprints.js
generated
8
lib/fingerprints.js
generated
@@ -160,7 +160,7 @@ function locationUpdateCallback(result, location, logger) {
|
||||
// the source file so we can hash it.
|
||||
// If possible returns a absolute file path for the source file,
|
||||
// or if not possible then returns undefined.
|
||||
function resolveUriToFile(location, artifacts, checkoutPath, logger) {
|
||||
function resolveUriToFile(location, artifacts, sourceRoot, logger) {
|
||||
// This may be referencing an artifact
|
||||
if (!location.uri && location.index !== undefined) {
|
||||
if (typeof location.index !== "number" ||
|
||||
@@ -188,7 +188,7 @@ function resolveUriToFile(location, artifacts, checkoutPath, logger) {
|
||||
return undefined;
|
||||
}
|
||||
// Discard any absolute paths that aren't in the src root
|
||||
const srcRootPrefix = `${checkoutPath}/`;
|
||||
const srcRootPrefix = `${sourceRoot}/`;
|
||||
if (uri.startsWith("/") && !uri.startsWith(srcRootPrefix)) {
|
||||
logger.debug(`Ignoring location URI "${uri}" as it is outside of the src root`);
|
||||
return undefined;
|
||||
@@ -213,7 +213,7 @@ function resolveUriToFile(location, artifacts, checkoutPath, logger) {
|
||||
exports.resolveUriToFile = resolveUriToFile;
|
||||
// Compute fingerprints for results in the given sarif file
|
||||
// and return an updated sarif file contents.
|
||||
async function addFingerprints(sarifContents, checkoutPath, logger) {
|
||||
async function addFingerprints(sarifContents, sourceRoot, logger) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
const sarif = JSON.parse(sarifContents);
|
||||
// Gather together results for the same file and construct
|
||||
@@ -233,7 +233,7 @@ async function addFingerprints(sarifContents, checkoutPath, logger) {
|
||||
// Locations without a line number are unlikely to be source files
|
||||
continue;
|
||||
}
|
||||
const filepath = resolveUriToFile(primaryLocation.physicalLocation.artifactLocation, artifacts, checkoutPath, logger);
|
||||
const filepath = resolveUriToFile(primaryLocation.physicalLocation.artifactLocation, artifacts, sourceRoot, logger);
|
||||
if (!filepath) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
8
lib/fingerprints.test.js
generated
8
lib/fingerprints.test.js
generated
@@ -167,8 +167,8 @@ ava_1.default("addFingerprints", async (t) => {
|
||||
input = JSON.stringify(JSON.parse(input));
|
||||
expected = JSON.stringify(JSON.parse(expected));
|
||||
// The URIs in the SARIF files resolve to files in the testdata directory
|
||||
const checkoutPath = path.normalize(`${__dirname}/../src/testdata`);
|
||||
t.deepEqual(await fingerprints.addFingerprints(input, checkoutPath, logging_1.getRunnerLogger(true)), expected);
|
||||
const sourceRoot = path.normalize(`${__dirname}/../src/testdata`);
|
||||
t.deepEqual(await fingerprints.addFingerprints(input, sourceRoot, logging_1.getRunnerLogger(true)), expected);
|
||||
});
|
||||
ava_1.default("missingRegions", async (t) => {
|
||||
// Run an end-to-end test on a test file
|
||||
@@ -182,7 +182,7 @@ ava_1.default("missingRegions", async (t) => {
|
||||
input = JSON.stringify(JSON.parse(input));
|
||||
expected = JSON.stringify(JSON.parse(expected));
|
||||
// The URIs in the SARIF files resolve to files in the testdata directory
|
||||
const checkoutPath = path.normalize(`${__dirname}/../src/testdata`);
|
||||
t.deepEqual(await fingerprints.addFingerprints(input, checkoutPath, logging_1.getRunnerLogger(true)), expected);
|
||||
const sourceRoot = path.normalize(`${__dirname}/../src/testdata`);
|
||||
t.deepEqual(await fingerprints.addFingerprints(input, sourceRoot, logging_1.getRunnerLogger(true)), expected);
|
||||
});
|
||||
//# sourceMappingURL=fingerprints.test.js.map
|
||||
File diff suppressed because one or more lines are too long
6
lib/init-action.js
generated
6
lib/init-action.js
generated
@@ -7,6 +7,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const init_1 = require("./init");
|
||||
@@ -72,7 +73,7 @@ async function run() {
|
||||
const initCodeQLResult = await init_1.initCodeQL(actions_util_1.getOptionalInput("tools"), apiDetails, actions_util_1.getTemporaryDirectory(), actions_util_1.getToolCacheDirectory(), gitHubVersion.type, logger);
|
||||
codeql = initCodeQLResult.codeql;
|
||||
toolsVersion = initCodeQLResult.toolsVersion;
|
||||
config = await init_1.initConfig(actions_util_1.getOptionalInput("languages"), actions_util_1.getOptionalInput("queries"), actions_util_1.getOptionalInput("config-file"), actions_util_1.getOptionalInput("db-location"), repository_1.parseRepositoryNwo(util_1.getRequiredEnvParam("GITHUB_REPOSITORY")), actions_util_1.getTemporaryDirectory(), util_1.getRequiredEnvParam("RUNNER_TOOL_CACHE"), codeql, util_1.getRequiredEnvParam("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, logger);
|
||||
config = await init_1.initConfig(actions_util_1.getOptionalInput("languages"), actions_util_1.getOptionalInput("queries"), actions_util_1.getOptionalInput("packs"), actions_util_1.getOptionalInput("config-file"), actions_util_1.getOptionalInput("db-location"), repository_1.parseRepositoryNwo(util_1.getRequiredEnvParam("GITHUB_REPOSITORY")), actions_util_1.getTemporaryDirectory(), util_1.getRequiredEnvParam("RUNNER_TOOL_CACHE"), codeql, util_1.getRequiredEnvParam("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, logger);
|
||||
if (config.languages.includes(languages_1.Language.python) &&
|
||||
actions_util_1.getRequiredInput("setup-python-dependencies") === "true") {
|
||||
try {
|
||||
@@ -99,7 +100,8 @@ async function run() {
|
||||
// Setup CODEQL_RAM flag (todo improve this https://github.com/github/dsp-code-scanning/issues/935)
|
||||
const codeqlRam = process.env["CODEQL_RAM"] || "6500";
|
||||
core.exportVariable("CODEQL_RAM", codeqlRam);
|
||||
const tracerConfig = await init_1.runInit(codeql, config);
|
||||
const sourceRoot = path.resolve(util_1.getRequiredEnvParam("GITHUB_WORKSPACE"), actions_util_1.getOptionalInput("source-root") || "");
|
||||
const tracerConfig = await init_1.runInit(codeql, config, sourceRoot);
|
||||
if (tracerConfig !== undefined) {
|
||||
for (const [key, value] of Object.entries(tracerConfig.env)) {
|
||||
core.exportVariable(key, value);
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"init-action.js","sourceRoot":"","sources":["../src/init-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,iDASwB;AAGxB,iCAMgB;AAChB,2CAAuC;AACvC,uCAA6C;AAC7C,6CAAkD;AAClD,iCAMgB;AAEhB,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAsBvC,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,MAA0B,EAC1B,YAAoB;;IAEpB,MAAM,gBAAgB,GAAG,MAAM,qCAAsB,CACnD,MAAM,EACN,SAAS,EACT,SAAS,CACV,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,iBAAiB,GAAG,+BAAgB,CAAC,WAAW,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CACvE,GAAG,CACJ,CAAC;IACF,MAAM,qBAAqB,GAAG,MAAM,CAAC,iBAAiB,CACpD,yBAAyB,CAC1B;QACC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,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,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
39
lib/init.js
generated
39
lib/init.js
generated
@@ -24,16 +24,15 @@ async function initCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant,
|
||||
return { codeql, toolsVersion };
|
||||
}
|
||||
exports.initCodeQL = initCodeQL;
|
||||
async function initConfig(languagesInput, queriesInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger) {
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
logger.startGroup("Load language configuration");
|
||||
const config = await configUtils.initConfig(languagesInput, queriesInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, checkoutPath, gitHubVersion, apiDetails, logger);
|
||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger);
|
||||
analysisPaths.printPathFiltersWarning(config, logger);
|
||||
logger.endGroup();
|
||||
return config;
|
||||
}
|
||||
exports.initConfig = initConfig;
|
||||
async function runInit(codeql, config) {
|
||||
const sourceRoot = path.resolve();
|
||||
async function runInit(codeql, config, sourceRoot) {
|
||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||
// TODO: replace this code once CodeQL supports multi-language tracing
|
||||
for (const language of config.languages) {
|
||||
@@ -129,26 +128,15 @@ exports.injectWindowsTracer = injectWindowsTracer;
|
||||
async function installPythonDeps(codeql, logger) {
|
||||
logger.startGroup("Setup Python dependencies");
|
||||
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
||||
// Setup tools on the GitHub hosted runners
|
||||
if (process.env["ImageOS"] !== undefined) {
|
||||
try {
|
||||
if (process.platform === "win32") {
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [path.join(scriptsFolder, "install_tools.ps1")]).exec();
|
||||
}
|
||||
else {
|
||||
await new toolrunner.ToolRunner(path.join(scriptsFolder, "install_tools.sh")).exec();
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// This script tries to install some needed tools in the runner. It should not fail, but if it does
|
||||
// we just abort the process without failing the action
|
||||
logger.endGroup();
|
||||
logger.warning("Unable to download and extract the tools needed for installing the python dependencies. You can call this action with 'setup-python-dependencies: false' to disable this process.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Install dependencies
|
||||
try {
|
||||
if (process.platform === "win32") {
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
|
||||
path.join(scriptsFolder, "install_tools.ps1"),
|
||||
]).exec();
|
||||
}
|
||||
else {
|
||||
await new toolrunner.ToolRunner(path.join(scriptsFolder, "install_tools.sh")).exec();
|
||||
}
|
||||
const script = "auto_install_packages.py";
|
||||
if (process.platform === "win32") {
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("py"), [
|
||||
@@ -165,7 +153,10 @@ async function installPythonDeps(codeql, logger) {
|
||||
}
|
||||
catch (e) {
|
||||
logger.endGroup();
|
||||
logger.warning("We were unable to install your python dependencies. You can call this action with 'setup-python-dependencies: false' to disable this process.");
|
||||
logger.warning(`An error occurred while trying to automatically install Python dependencies: ${e}\n` +
|
||||
"Please make sure any necessary dependencies are installed before calling the codeql-action/analyze " +
|
||||
"step, and add a 'setup-python-dependencies: false' argument to this step to disable our automatic " +
|
||||
"dependency installation and avoid this warning.");
|
||||
return;
|
||||
}
|
||||
logger.endGroup();
|
||||
|
||||
@@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AAQ,EAAE,CAAC;AACpB,CAAC;AAtCD,8CAsCC"}
|
||||
23
lib/runner.js
generated
23
lib/runner.js
generated
@@ -90,6 +90,12 @@ program
|
||||
.option("--github-auth-stdin", "Read GitHub Apps token or personal access token from stdin.")
|
||||
.option("--languages <languages>", "Comma-separated list of languages to analyze. Otherwise detects and analyzes all supported languages from the repo.")
|
||||
.option("--queries <queries>", "Comma-separated list of additional queries to run. This overrides the same setting in a configuration file.")
|
||||
.option("--packs <packs>", `[Experimental] Comma-separated list of packs to run. Reference a pack in the format scope/name[@version]. If version is not
|
||||
specified, then the latest version of the pack is used. By default, this overrides the same setting in a
|
||||
configuration file; prefix with "+" to use both sets of packs.
|
||||
|
||||
This option is only available in single-language analyses. To use packs in multi-language
|
||||
analyses, you must specify packs in the codeql-config.yml file.`)
|
||||
.option("--config-file <file>", "Path to config file.")
|
||||
.option("--codeql-path <path>", "Path to a copy of the CodeQL CLI executable to use. Otherwise downloads a copy.")
|
||||
.option("--temp-dir <dir>", 'Directory to use for temporary files. Default is "./codeql-runner".')
|
||||
@@ -103,6 +109,7 @@ program
|
||||
try {
|
||||
const tempDir = getTempDir(cmd.tempDir);
|
||||
const toolsDir = getToolsDir(cmd.toolsDir);
|
||||
const checkoutPath = cmd.checkoutPath || process.cwd();
|
||||
// Wipe the temp dir
|
||||
logger.info(`Cleaning temp directory ${tempDir}`);
|
||||
fs.rmdirSync(tempDir, { recursive: true });
|
||||
@@ -122,8 +129,10 @@ program
|
||||
else {
|
||||
codeql = (await init_1.initCodeQL(undefined, apiDetails, tempDir, toolsDir, gitHubVersion.type, logger)).codeql;
|
||||
}
|
||||
const config = await init_1.initConfig(cmd.languages, cmd.queries, cmd.configFile, undefined, repository_1.parseRepositoryNwo(cmd.repository), tempDir, toolsDir, codeql, cmd.checkoutPath || process.cwd(), gitHubVersion, apiDetails, logger);
|
||||
const tracerConfig = await init_1.runInit(codeql, config);
|
||||
const workspacePath = checkoutPath;
|
||||
const config = await init_1.initConfig(cmd.languages, cmd.queries, cmd.packs, cmd.configFile, undefined, repository_1.parseRepositoryNwo(cmd.repository), tempDir, toolsDir, codeql, workspacePath, gitHubVersion, apiDetails, logger);
|
||||
const sourceRoot = checkoutPath;
|
||||
const tracerConfig = await init_1.runInit(codeql, config, sourceRoot);
|
||||
if (tracerConfig === undefined) {
|
||||
return;
|
||||
}
|
||||
@@ -237,12 +246,15 @@ program
|
||||
url: util_1.parseGitHubUrl(cmd.githubUrl),
|
||||
};
|
||||
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
||||
await analyze_1.runAnalyze(outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), util_1.getThreadsFlag(cmd.threads, logger), cmd.category, config, logger);
|
||||
const threads = util_1.getThreadsFlag(cmd.threads, logger);
|
||||
await analyze_1.runFinalize(outputDir, threads, config, logger);
|
||||
await analyze_1.runQueries(outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), threads, cmd.category, config, logger);
|
||||
if (!cmd.upload) {
|
||||
logger.info("Not uploading results");
|
||||
return;
|
||||
}
|
||||
await upload_lib.uploadFromRunner(outputDir, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), cmd.category, cmd.checkoutPath || process.cwd(), config.gitHubVersion, apiDetails, logger);
|
||||
const sourceRoot = cmd.checkoutPath || process.cwd();
|
||||
await upload_lib.uploadFromRunner(outputDir, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), cmd.category, sourceRoot, config.gitHubVersion, apiDetails, logger);
|
||||
}
|
||||
catch (e) {
|
||||
logger.error("Analyze failed");
|
||||
@@ -272,7 +284,8 @@ program
|
||||
};
|
||||
try {
|
||||
const gitHubVersion = await util_1.getGitHubVersion(apiDetails);
|
||||
await upload_lib.uploadFromRunner(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), cmd.category, cmd.checkoutPath || process.cwd(), gitHubVersion, apiDetails, logger);
|
||||
const sourceRoot = cmd.checkoutPath || process.cwd();
|
||||
await upload_lib.uploadFromRunner(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), cmd.category, sourceRoot, gitHubVersion, apiDetails, logger);
|
||||
}
|
||||
catch (e) {
|
||||
logger.error("Upload failed");
|
||||
|
||||
File diff suppressed because one or more lines are too long
7
lib/toolcache.js
generated
7
lib/toolcache.js
generated
@@ -15,6 +15,7 @@ const io = __importStar(require("@actions/io"));
|
||||
const actionsToolcache = __importStar(require("@actions/tool-cache"));
|
||||
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const uuid_1 = require("uuid");
|
||||
const util_1 = require("./util");
|
||||
/*
|
||||
* This file acts as an interface to the functionality of the actions toolcache.
|
||||
@@ -204,6 +205,12 @@ function findAllVersions(toolName, toolCacheDir, logger) {
|
||||
}
|
||||
}
|
||||
exports.findAllVersions = findAllVersions;
|
||||
async function downloadTool(url, tempDir, headers) {
|
||||
const dest = path.join(tempDir, uuid_1.v4());
|
||||
const finalHeaders = Object.assign({ "User-Agent": "CodeQL Action" }, headers);
|
||||
return await actionsToolcache.downloadTool(url, dest, undefined, finalHeaders);
|
||||
}
|
||||
exports.downloadTool = downloadTool;
|
||||
function createExtractFolder(tempDir) {
|
||||
// create a temp dir
|
||||
const dest = path.join(tempDir, "toolcache-temp");
|
||||
|
||||
File diff suppressed because one or more lines are too long
10
lib/upload-lib.js
generated
10
lib/upload-lib.js
generated
@@ -122,8 +122,8 @@ exports.uploadFromActions = uploadFromActions;
|
||||
// Uploads a single sarif file or a directory of sarif files
|
||||
// depending on what the path happens to refer to.
|
||||
// Returns true iff the upload occurred and succeeded
|
||||
async function uploadFromRunner(sarifPath, repositoryNwo, commitOid, ref, category, checkoutPath, gitHubVersion, apiDetails, logger) {
|
||||
return await uploadFiles(getSarifFilePaths(sarifPath), repositoryNwo, commitOid, ref, undefined, category, undefined, undefined, checkoutPath, undefined, gitHubVersion, apiDetails, logger);
|
||||
async function uploadFromRunner(sarifPath, repositoryNwo, commitOid, ref, category, sourceRoot, gitHubVersion, apiDetails, logger) {
|
||||
return await uploadFiles(getSarifFilePaths(sarifPath), repositoryNwo, commitOid, ref, undefined, category, undefined, undefined, sourceRoot, undefined, gitHubVersion, apiDetails, logger);
|
||||
}
|
||||
exports.uploadFromRunner = uploadFromRunner;
|
||||
function getSarifFilePaths(sarifPath) {
|
||||
@@ -227,7 +227,7 @@ function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, wo
|
||||
exports.buildPayload = buildPayload;
|
||||
// Uploads the given set of sarif files.
|
||||
// Returns true iff the upload occurred and succeeded
|
||||
async function uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKey, category, analysisName, workflowRunID, checkoutPath, environment, gitHubVersion, apiDetails, logger) {
|
||||
async function uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKey, category, analysisName, workflowRunID, sourceRoot, environment, gitHubVersion, apiDetails, logger) {
|
||||
logger.startGroup("Uploading results");
|
||||
logger.info(`Processing sarif files: ${JSON.stringify(sarifFiles)}`);
|
||||
if (util.isActions()) {
|
||||
@@ -243,10 +243,10 @@ async function uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKe
|
||||
validateSarifFileSchema(file, logger);
|
||||
}
|
||||
let sarifPayload = combineSarifFiles(sarifFiles);
|
||||
sarifPayload = await fingerprints.addFingerprints(sarifPayload, checkoutPath, logger);
|
||||
sarifPayload = await fingerprints.addFingerprints(sarifPayload, sourceRoot, logger);
|
||||
sarifPayload = populateRunAutomationDetails(sarifPayload, category, analysisKey, environment);
|
||||
const zippedSarif = zlib_1.default.gzipSync(sarifPayload).toString("base64");
|
||||
const checkoutURI = file_url_1.default(checkoutPath);
|
||||
const checkoutURI = file_url_1.default(sourceRoot);
|
||||
const toolNames = util.getToolNames(sarifPayload);
|
||||
const payload = buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, workflowRunID, checkoutURI, environment, toolNames, gitHubVersion);
|
||||
// Log some useful debug info about the info
|
||||
|
||||
File diff suppressed because one or more lines are too long
12
lib/util.js
generated
12
lib/util.js
generated
@@ -408,4 +408,16 @@ function getRequiredEnvParam(paramName) {
|
||||
return value;
|
||||
}
|
||||
exports.getRequiredEnvParam = getRequiredEnvParam;
|
||||
class HTTPError extends Error {
|
||||
constructor(message, status) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
exports.HTTPError = HTTPError;
|
||||
function isHTTPError(arg) {
|
||||
var _a;
|
||||
return ((_a = arg) === null || _a === void 0 ? void 0 : _a.status) !== undefined && Number.isInteger(arg.status);
|
||||
}
|
||||
exports.isHTTPError = isHTTPError;
|
||||
//# sourceMappingURL=util.js.map
|
||||
File diff suppressed because one or more lines are too long
139
node_modules/.package-lock.json
generated
vendored
139
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.8",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -55,25 +55,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/io": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT"
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.1.tgz",
|
||||
"integrity": "sha512-Qi4JoKXjmE0O67wAOH6y0n26QXhMKMFo7GD/4IXNVcrtLjUlGjGuVys6pQgwF3ArfGTQu0XpqaNr0YhED2RaRA=="
|
||||
},
|
||||
"node_modules/@actions/tool-cache": {
|
||||
"version": "1.5.5",
|
||||
"license": "MIT",
|
||||
"version": "1.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.7.1.tgz",
|
||||
"integrity": "sha512-y1xxxOhXaBUIUit3lhepmu/0xdgiTMpnZRLmVdtF0hTm521doi+MdRRRP62czHvM7wxH6epj4JPNJQ3iJpOrkQ==",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.3",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/http-client": "^1.0.8",
|
||||
"@actions/io": "^1.0.1",
|
||||
"@actions/io": "^1.1.1",
|
||||
"semver": "^6.1.0",
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/tool-cache/node_modules/@actions/core": {
|
||||
"version": "1.2.4",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@actions/tool-cache/node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"license": "ISC",
|
||||
@@ -405,12 +403,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/js-yaml": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.1.tgz",
|
||||
"integrity": "sha512-xdOvNmXmrZqqPy3kuCQ+fz6wA0xU5pji9cd1nDrflWaAWtYLLGk5ykW0H6yg5TVyehHP1pfmuuSaZkhP+kspVA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.6",
|
||||
"dev": true,
|
||||
@@ -820,19 +812,11 @@
|
||||
},
|
||||
"node_modules/array-union": {
|
||||
"version": "2.1.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/array-uniq": {
|
||||
"version": "1.0.3",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/array.prototype.flat": {
|
||||
"version": "1.2.3",
|
||||
"dev": true,
|
||||
@@ -1259,7 +1243,6 @@
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.1",
|
||||
"braces": "~3.0.2",
|
||||
"fsevents": "~2.1.2",
|
||||
"glob-parent": "~5.1.0",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
@@ -2641,8 +2624,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/github-linguist": {
|
||||
"version": "2.4.2",
|
||||
"license": "MIT",
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.3.tgz",
|
||||
"integrity": "sha512-hKWn1QQ+9oUyOIcUhPzi6AxTcAkYHg4OOwK79Pr05SBTFmdNr7GQkMDJabSGCZwu7SDhEb5YeUwUGqrUfyo7PA==",
|
||||
"dependencies": {
|
||||
"chalk": "^2.2.0",
|
||||
"commander": "^2.11.0",
|
||||
@@ -2655,16 +2639,6 @@
|
||||
"loc": "dist/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/github-linguist/node_modules/array-union": {
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"array-uniq": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/github-linguist/node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"license": "MIT"
|
||||
@@ -2709,7 +2683,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/glob-parent": {
|
||||
"version": "5.1.1",
|
||||
"version": ">=5.1.2",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
@@ -3245,9 +3219,6 @@
|
||||
"node_modules/jsonfile": {
|
||||
"version": "4.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
@@ -3648,7 +3619,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/normalize-url": {
|
||||
"version": "4.5.0",
|
||||
"version": ">=4.5.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -3819,22 +3790,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ora/node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ora/node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ora/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"dev": true,
|
||||
@@ -4070,37 +4025,6 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/pkg-conf/node_modules/locate-path": {
|
||||
"version": "3.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-locate": "^3.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/pkg-conf/node_modules/p-locate": {
|
||||
"version": "3.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-limit": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/pkg-conf/node_modules/path-exists": {
|
||||
"version": "3.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/pkg-dir": {
|
||||
"version": "4.2.0",
|
||||
"dev": true,
|
||||
@@ -4352,17 +4276,6 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/read-pkg-up/node_modules/parse-json": {
|
||||
"version": "2.2.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"error-ex": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/read-pkg-up/node_modules/path-exists": {
|
||||
"version": "3.0.0",
|
||||
"dev": true,
|
||||
@@ -4382,14 +4295,6 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/read-pkg-up/node_modules/pify": {
|
||||
"version": "2.3.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/read-pkg-up/node_modules/read-pkg": {
|
||||
"version": "2.0.0",
|
||||
"dev": true,
|
||||
@@ -5375,22 +5280,6 @@
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi/node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi/node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"license": "ISC"
|
||||
|
||||
12
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
12
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
@@ -9,17 +9,6 @@ export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
export declare function isRooted(p: string): boolean;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
@@ -27,3 +16,4 @@ export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
||||
export declare function getCmdPath(): string;
|
||||
|
||||
77
node_modules/@actions/io/lib/io-util.js
generated
vendored
77
node_modules/@actions/io/lib/io-util.js
generated
vendored
@@ -1,4 +1,23 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -8,16 +27,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = require("assert");
|
||||
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||
@@ -60,49 +72,6 @@ function isRooted(p) {
|
||||
return p.startsWith('/');
|
||||
}
|
||||
exports.isRooted = isRooted;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||
fsPath = path.resolve(fsPath);
|
||||
if (depth >= maxDepth)
|
||||
return exports.mkdir(fsPath);
|
||||
try {
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
catch (err) {
|
||||
switch (err.code) {
|
||||
case 'ENOENT': {
|
||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
let stats;
|
||||
try {
|
||||
stats = yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err2) {
|
||||
throw err;
|
||||
}
|
||||
if (!stats.isDirectory())
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
@@ -199,4 +168,10 @@ function isUnixExecutable(stats) {
|
||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||
}
|
||||
// Get the path of cmd.exe in windows
|
||||
function getCmdPath() {
|
||||
var _a;
|
||||
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
|
||||
}
|
||||
exports.getCmdPath = getCmdPath;
|
||||
//# sourceMappingURL=io-util.js.map
|
||||
2
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
2
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,mCAAyB;AACzB,uCAAwB;AACxB,2CAA4B;AAEf,gBAYE,qTAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OA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,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC;AAED,qCAAqC;AACrC,SAAgB,UAAU;;IACxB,aAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAI,SAAS,CAAA;AAC5C,CAAC;AAFD,gCAEC"}
|
||||
2
node_modules/@actions/io/lib/io.d.ts
generated
vendored
2
node_modules/@actions/io/lib/io.d.ts
generated
vendored
@@ -6,6 +6,8 @@ export interface CopyOptions {
|
||||
recursive?: boolean;
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
/** Optional. Whether to copy the source directory along with all the files. Only takes effect when recursive=true and copying a directory. Default is true*/
|
||||
copySourceDirectory?: boolean;
|
||||
}
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
|
||||
57
node_modules/@actions/io/lib/io.js
generated
vendored
57
node_modules/@actions/io/lib/io.js
generated
vendored
@@ -1,4 +1,23 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -8,19 +27,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
||||
const assert_1 = require("assert");
|
||||
const childProcess = __importStar(require("child_process"));
|
||||
const path = __importStar(require("path"));
|
||||
const util_1 = require("util");
|
||||
const ioUtil = __importStar(require("./io-util"));
|
||||
const exec = util_1.promisify(childProcess.exec);
|
||||
const execFile = util_1.promisify(childProcess.execFile);
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
@@ -31,14 +46,14 @@ const exec = util_1.promisify(childProcess.exec);
|
||||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
const { force, recursive, copySourceDirectory } = readCopyOptions(options);
|
||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||
// Dest is an existing file, but not forcing
|
||||
if (destStat && destStat.isFile() && !force) {
|
||||
return;
|
||||
}
|
||||
// If dest is an existing directory, should copy inside.
|
||||
const newDest = destStat && destStat.isDirectory()
|
||||
const newDest = destStat && destStat.isDirectory() && copySourceDirectory
|
||||
? path.join(dest, path.basename(source))
|
||||
: dest;
|
||||
if (!(yield ioUtil.exists(source))) {
|
||||
@@ -103,12 +118,22 @@ function rmRF(inputPath) {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||
// Check for invalid characters
|
||||
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||
if (/[*"<>|]/.test(inputPath)) {
|
||||
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
||||
}
|
||||
try {
|
||||
const cmdPath = ioUtil.getCmdPath();
|
||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||
yield exec(`rd /s /q "${inputPath}"`);
|
||||
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||
env: { inputPath }
|
||||
});
|
||||
}
|
||||
else {
|
||||
yield exec(`del /f /a "${inputPath}"`);
|
||||
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||
env: { inputPath }
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
@@ -141,7 +166,7 @@ function rmRF(inputPath) {
|
||||
return;
|
||||
}
|
||||
if (isDir) {
|
||||
yield exec(`rm -rf "${inputPath}"`);
|
||||
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
@@ -159,7 +184,8 @@ exports.rmRF = rmRF;
|
||||
*/
|
||||
function mkdirP(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield ioUtil.mkdirP(fsPath);
|
||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||
yield ioUtil.mkdir(fsPath, { recursive: true });
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
@@ -257,7 +283,10 @@ exports.findInPath = findInPath;
|
||||
function readCopyOptions(options) {
|
||||
const force = options.force == null ? true : options.force;
|
||||
const recursive = Boolean(options.recursive);
|
||||
return { force, recursive };
|
||||
const copySourceDirectory = options.copySourceDirectory == null
|
||||
? true
|
||||
: Boolean(options.copySourceDirectory);
|
||||
return { force, recursive, copySourceDirectory };
|
||||
}
|
||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
||||
2
node_modules/@actions/io/lib/io.js.map
generated
vendored
2
node_modules/@actions/io/lib/io.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@actions/io/package.json
generated
vendored
2
node_modules/@actions/io/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/io",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "Actions io lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
4
node_modules/@actions/tool-cache/README.md
generated
vendored
4
node_modules/@actions/tool-cache/README.md
generated
vendored
@@ -29,6 +29,10 @@ if (process.platform === 'win32') {
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
||||
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
||||
}
|
||||
else if (process.platform === 'darwin') {
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0.pkg');
|
||||
const node12ExtractedFolder = await tc.extractXar(node12Path, 'path/to/extract/to');
|
||||
}
|
||||
else {
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||
|
||||
46
node_modules/@actions/tool-cache/lib/manifest.js
generated
vendored
46
node_modules/@actions/tool-cache/lib/manifest.js
generated
vendored
@@ -1,4 +1,23 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -8,14 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
|
||||
const semver = __importStar(require("semver"));
|
||||
const core_1 = require("@actions/core");
|
||||
// needs to be require for core node modules to be mocked
|
||||
@@ -84,8 +97,13 @@ function _getOsVersion() {
|
||||
const lines = lsbContents.split('\n');
|
||||
for (const line of lines) {
|
||||
const parts = line.split('=');
|
||||
if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') {
|
||||
version = parts[1].trim();
|
||||
if (parts.length === 2 &&
|
||||
(parts[0].trim() === 'VERSION_ID' ||
|
||||
parts[0].trim() === 'DISTRIB_RELEASE')) {
|
||||
version = parts[1]
|
||||
.trim()
|
||||
.replace(/^"/, '')
|
||||
.replace(/"$/, '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -95,10 +113,14 @@ function _getOsVersion() {
|
||||
}
|
||||
exports._getOsVersion = _getOsVersion;
|
||||
function _readLinuxVersionFile() {
|
||||
const lsbFile = '/etc/lsb-release';
|
||||
const lsbReleaseFile = '/etc/lsb-release';
|
||||
const osReleaseFile = '/etc/os-release';
|
||||
let contents = '';
|
||||
if (fs.existsSync(lsbFile)) {
|
||||
contents = fs.readFileSync(lsbFile).toString();
|
||||
if (fs.existsSync(lsbReleaseFile)) {
|
||||
contents = fs.readFileSync(lsbReleaseFile).toString();
|
||||
}
|
||||
else if (fs.existsSync(osReleaseFile)) {
|
||||
contents = fs.readFileSync(osReleaseFile).toString();
|
||||
}
|
||||
return contents;
|
||||
}
|
||||
|
||||
2
node_modules/@actions/tool-cache/lib/manifest.js.map
generated
vendored
2
node_modules/@actions/tool-cache/lib/manifest.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,wCAAmC;AAEnC,yDAAyD;AACzD,qDAAqD;AAErD,yBAAyB;AACzB,oCAAoC;AACpC,yBAAyB;AAqDzB,SAAsB,UAAU,CAC9B,WAAmB,EACnB,MAAe,EACf,UAA0B,EAC1B,UAAkB;;QAElB,MAAM,UAAU,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAA;QAEhC,IAAI,MAAgC,CAAA;QACpC,IAAI,KAA+B,CAAA;QAEnC,IAAI,IAAkC,CAAA;QACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAA;YAEjC,YAAK,CAAC,SAAS,OAAO,cAAc,WAAW,EAAE,CAAC,CAAA;YAClD,IACE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC;gBACtC,CAAC,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,EACxC;gBACA,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACjC,YAAK,CACH,GA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ED,OAAO,OAAO,CAAA;AAChB,CAAC;AApCD,sCAoCC;AAED,SAAgB,qBAAqB;IACnC,MAAM,cAAc,GAAG,kBAAkB,CAAA;IACzC,MAAM,aAAa,GAAG,iBAAiB,CAAA;IACvC,IAAI,QAAQ,GAAG,EAAE,CAAA;IAEjB,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;QACjC,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAA;KACtD;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QACvC,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAA;KACrD;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AAZD,sDAYC"}
|
||||
27
node_modules/@actions/tool-cache/lib/retry-helper.js
generated
vendored
27
node_modules/@actions/tool-cache/lib/retry-helper.js
generated
vendored
@@ -1,4 +1,23 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -8,14 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RetryHelper = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
/**
|
||||
* Internal class for retries
|
||||
|
||||
2
node_modules/@actions/tool-cache/lib/retry-helper.js.map
generated
vendored
2
node_modules/@actions/tool-cache/lib/retry-helper.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"retry-helper.js","sourceRoot":"","sources":["../src/retry-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AAErC;;GAEG;AACH,MAAa,WAAW;IAKtB,YAAY,WAAmB,EAAE,UAAkB,EAAE,UAAkB;QACrE,IAAI,WAAW,GAAG,CAAC,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;SACrE;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACxC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACxC,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;IACH,CAAC;IAEK,OAAO,CACX,MA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U,CAChB,CAAA;IACH,CAAC;IAEa,KAAK,CAAC,OAAe;;YACjC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAA;QACpE,CAAC;KAAA;CACF;AAxDD,kCAwDC"}
|
||||
26
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
26
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
@@ -1,4 +1,5 @@
|
||||
import * as mm from './manifest';
|
||||
import { IHeaders } from '@actions/http-client/interfaces';
|
||||
export declare class HTTPError extends Error {
|
||||
readonly httpStatusCode: number | undefined;
|
||||
constructor(httpStatusCode: number | undefined);
|
||||
@@ -9,9 +10,10 @@ export declare class HTTPError extends Error {
|
||||
* @param url url of tool to download
|
||||
* @param dest path to download tool
|
||||
* @param auth authorization header
|
||||
* @param headers other headers
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
export declare function downloadTool(url: string, dest?: string, auth?: string): Promise<string>;
|
||||
export declare function downloadTool(url: string, dest?: string, auth?: string, headers?: IHeaders): Promise<string>;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
@@ -37,6 +39,15 @@ export declare function extract7z(file: string, dest?: string, _7zPath?: string)
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractTar(file: string, dest?: string, flags?: string | string[]): Promise<string>;
|
||||
/**
|
||||
* Extract a xar compatible archive
|
||||
*
|
||||
* @param file path to the archive
|
||||
* @param dest destination directory. Optional.
|
||||
* @param flags flags for the xar. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractXar(file: string, dest?: string, flags?: string | string[]): Promise<string>;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
@@ -84,3 +95,16 @@ export declare type IToolRelease = mm.IToolRelease;
|
||||
export declare type IToolReleaseFile = mm.IToolReleaseFile;
|
||||
export declare function getManifestFromRepo(owner: string, repo: string, auth?: string, branch?: string): Promise<IToolRelease[]>;
|
||||
export declare function findFromManifest(versionSpec: string, stable: boolean, manifest: IToolRelease[], archFilter?: string): Promise<IToolRelease | undefined>;
|
||||
/**
|
||||
* Check if version string is explicit
|
||||
*
|
||||
* @param versionSpec version string to check
|
||||
*/
|
||||
export declare function isExplicitVersion(versionSpec: string): boolean;
|
||||
/**
|
||||
* Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
|
||||
*
|
||||
* @param versions array of versions to evaluate
|
||||
* @param versionSpec semantic version spec to satisfy
|
||||
*/
|
||||
export declare function evaluateVersions(versions: string[], versionSpec: string): string;
|
||||
|
||||
163
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
163
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
@@ -1,4 +1,23 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -8,17 +27,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const fs = __importStar(require("fs"));
|
||||
@@ -42,6 +55,7 @@ class HTTPError extends Error {
|
||||
}
|
||||
exports.HTTPError = HTTPError;
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const IS_MAC = process.platform === 'darwin';
|
||||
const userAgent = 'actions/tool-cache';
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
@@ -49,9 +63,10 @@ const userAgent = 'actions/tool-cache';
|
||||
* @param url url of tool to download
|
||||
* @param dest path to download tool
|
||||
* @param auth authorization header
|
||||
* @param headers other headers
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
function downloadTool(url, dest, auth) {
|
||||
function downloadTool(url, dest, auth, headers) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
||||
yield io.mkdirP(path.dirname(dest));
|
||||
@@ -62,7 +77,7 @@ function downloadTool(url, dest, auth) {
|
||||
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
||||
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
||||
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||
return yield downloadToolAttempt(url, dest || '', auth);
|
||||
return yield downloadToolAttempt(url, dest || '', auth, headers);
|
||||
}), (err) => {
|
||||
if (err instanceof HTTPError && err.httpStatusCode) {
|
||||
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
||||
@@ -78,7 +93,7 @@ function downloadTool(url, dest, auth) {
|
||||
});
|
||||
}
|
||||
exports.downloadTool = downloadTool;
|
||||
function downloadToolAttempt(url, dest, auth) {
|
||||
function downloadToolAttempt(url, dest, auth, headers) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (fs.existsSync(dest)) {
|
||||
throw new Error(`Destination file path ${dest} already exists`);
|
||||
@@ -87,12 +102,12 @@ function downloadToolAttempt(url, dest, auth) {
|
||||
const http = new httpm.HttpClient(userAgent, [], {
|
||||
allowRetries: false
|
||||
});
|
||||
let headers;
|
||||
if (auth) {
|
||||
core.debug('set auth');
|
||||
headers = {
|
||||
authorization: auth
|
||||
};
|
||||
if (headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers.authorization = auth;
|
||||
}
|
||||
const response = yield http.get(url, headers);
|
||||
if (response.message.statusCode !== 200) {
|
||||
@@ -250,6 +265,7 @@ function extractTar(file, dest, flags = 'xz') {
|
||||
if (isGnuTar) {
|
||||
// Suppress warnings when using GNU tar to extract archives created by BSD tar
|
||||
args.push('--warning=no-unknown-keyword');
|
||||
args.push('--overwrite');
|
||||
}
|
||||
args.push('-C', destArg, '-f', fileArg);
|
||||
yield exec_1.exec(`tar`, args);
|
||||
@@ -257,6 +273,36 @@ function extractTar(file, dest, flags = 'xz') {
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
/**
|
||||
* Extract a xar compatible archive
|
||||
*
|
||||
* @param file path to the archive
|
||||
* @param dest destination directory. Optional.
|
||||
* @param flags flags for the xar. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractXar(file, dest, flags = []) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(IS_MAC, 'extractXar() not supported on current OS');
|
||||
assert_1.ok(file, 'parameter "file" is required');
|
||||
dest = yield _createExtractFolder(dest);
|
||||
let args;
|
||||
if (flags instanceof Array) {
|
||||
args = flags;
|
||||
}
|
||||
else {
|
||||
args = [flags];
|
||||
}
|
||||
args.push('-x', '-C', dest, '-f', file);
|
||||
if (core.isDebug()) {
|
||||
args.push('-v');
|
||||
}
|
||||
const xarPath = yield io.which('xar', true);
|
||||
yield exec_1.exec(`"${xarPath}"`, _unique(args));
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractXar = extractXar;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
@@ -285,20 +331,50 @@ function extractZipWin(file, dest) {
|
||||
// build the powershell command
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||
// run powershell
|
||||
const powershellPath = yield io.which('powershell', true);
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||
const pwshPath = yield io.which('pwsh', false);
|
||||
//To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
|
||||
//and the -Force flag for Expand-Archive as a fallback
|
||||
if (pwshPath) {
|
||||
//attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
|
||||
const pwshCommand = [
|
||||
`$ErrorActionPreference = 'Stop' ;`,
|
||||
`try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
|
||||
`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
|
||||
`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
|
||||
].join(' ');
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
pwshCommand
|
||||
];
|
||||
core.debug(`Using pwsh at path: ${pwshPath}`);
|
||||
yield exec_1.exec(`"${pwshPath}"`, args);
|
||||
}
|
||||
else {
|
||||
const powershellCommand = [
|
||||
`$ErrorActionPreference = 'Stop' ;`,
|
||||
`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
|
||||
`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
|
||||
`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
|
||||
].join(' ');
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
powershellCommand
|
||||
];
|
||||
const powershellPath = yield io.which('powershell', true);
|
||||
core.debug(`Using powershell at path: ${powershellPath}`);
|
||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
function extractZipNix(file, dest) {
|
||||
@@ -308,6 +384,7 @@ function extractZipNix(file, dest) {
|
||||
if (!core.isDebug()) {
|
||||
args.unshift('-q');
|
||||
}
|
||||
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
|
||||
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
|
||||
});
|
||||
}
|
||||
@@ -390,9 +467,9 @@ function find(toolName, versionSpec, arch) {
|
||||
}
|
||||
arch = arch || os.arch();
|
||||
// attempt to resolve an explicit version
|
||||
if (!_isExplicitVersion(versionSpec)) {
|
||||
if (!isExplicitVersion(versionSpec)) {
|
||||
const localVersions = findAllVersions(toolName, arch);
|
||||
const match = _evaluateVersions(localVersions, versionSpec);
|
||||
const match = evaluateVersions(localVersions, versionSpec);
|
||||
versionSpec = match;
|
||||
}
|
||||
// check for the explicit version in the cache
|
||||
@@ -425,7 +502,7 @@ function findAllVersions(toolName, arch) {
|
||||
if (fs.existsSync(toolPath)) {
|
||||
const children = fs.readdirSync(toolPath);
|
||||
for (const child of children) {
|
||||
if (_isExplicitVersion(child)) {
|
||||
if (isExplicitVersion(child)) {
|
||||
const fullPath = path.join(toolPath, child, arch || '');
|
||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||
versions.push(child);
|
||||
@@ -508,14 +585,26 @@ function _completeToolPath(tool, version, arch) {
|
||||
fs.writeFileSync(markerPath, '');
|
||||
core.debug('finished caching tool');
|
||||
}
|
||||
function _isExplicitVersion(versionSpec) {
|
||||
/**
|
||||
* Check if version string is explicit
|
||||
*
|
||||
* @param versionSpec version string to check
|
||||
*/
|
||||
function isExplicitVersion(versionSpec) {
|
||||
const c = semver.clean(versionSpec) || '';
|
||||
core.debug(`isExplicit: ${c}`);
|
||||
const valid = semver.valid(c) != null;
|
||||
core.debug(`explicit? ${valid}`);
|
||||
return valid;
|
||||
}
|
||||
function _evaluateVersions(versions, versionSpec) {
|
||||
exports.isExplicitVersion = isExplicitVersion;
|
||||
/**
|
||||
* Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
|
||||
*
|
||||
* @param versions array of versions to evaluate
|
||||
* @param versionSpec semantic version spec to satisfy
|
||||
*/
|
||||
function evaluateVersions(versions, versionSpec) {
|
||||
let version = '';
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
versions = versions.sort((a, b) => {
|
||||
@@ -540,6 +629,7 @@ function _evaluateVersions(versions, versionSpec) {
|
||||
}
|
||||
return version;
|
||||
}
|
||||
exports.evaluateVersions = evaluateVersions;
|
||||
/**
|
||||
* Gets RUNNER_TOOL_CACHE
|
||||
*/
|
||||
@@ -565,4 +655,11 @@ function _getGlobal(key, defaultValue) {
|
||||
/* eslint-enable @typescript-eslint/no-explicit-any */
|
||||
return value !== undefined ? value : defaultValue;
|
||||
}
|
||||
/**
|
||||
* Returns an array of unique values.
|
||||
* @param values Values to make unique.
|
||||
*/
|
||||
function _unique(values) {
|
||||
return Array.from(new Set(values));
|
||||
}
|
||||
//# sourceMappingURL=tool-cache.js.map
|
||||
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
File diff suppressed because one or more lines are too long
146
node_modules/@actions/tool-cache/node_modules/@actions/core/README.md
generated
vendored
146
node_modules/@actions/tool-cache/node_modules/@actions/core/README.md
generated
vendored
@@ -1,146 +0,0 @@
|
||||
# `@actions/core`
|
||||
|
||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||
|
||||
## Usage
|
||||
|
||||
### Import the package
|
||||
|
||||
```js
|
||||
// javascript
|
||||
const core = require('@actions/core');
|
||||
|
||||
// typescript
|
||||
import * as core from '@actions/core';
|
||||
```
|
||||
|
||||
#### Inputs/Outputs
|
||||
|
||||
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||
|
||||
```js
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
#### Exporting variables
|
||||
|
||||
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||
|
||||
```js
|
||||
core.exportVariable('envVar', 'Val');
|
||||
```
|
||||
|
||||
#### Setting a secret
|
||||
|
||||
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||
|
||||
```js
|
||||
core.setSecret('myPassword');
|
||||
```
|
||||
|
||||
#### PATH Manipulation
|
||||
|
||||
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||
|
||||
```js
|
||||
core.addPath('/path/to/mytool');
|
||||
```
|
||||
|
||||
#### Exit codes
|
||||
|
||||
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
try {
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
// setFailed logs the message and sets a failing exit code
|
||||
core.setFailed(`Action failed with error ${err}`);
|
||||
}
|
||||
|
||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('input');
|
||||
try {
|
||||
core.debug('Inside try block');
|
||||
|
||||
if (!myInput) {
|
||||
core.warning('myInput was not set');
|
||||
}
|
||||
|
||||
if (core.isDebug()) {
|
||||
// curl -v https://github.com
|
||||
} else {
|
||||
// curl https://github.com
|
||||
}
|
||||
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Error ${err}, action may still succeed though`);
|
||||
}
|
||||
```
|
||||
|
||||
This library can also wrap chunks of output in foldable groups.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core')
|
||||
|
||||
// Manually wrap output
|
||||
core.startGroup('Do some function')
|
||||
doSomeFunction()
|
||||
core.endGroup()
|
||||
|
||||
// Wrap an asynchronous function call
|
||||
const result = await core.group('Do something async', async () => {
|
||||
const response = await doSomeHTTPRequest()
|
||||
return response
|
||||
})
|
||||
```
|
||||
|
||||
#### Action state
|
||||
|
||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||
|
||||
**action.yml**
|
||||
```yaml
|
||||
name: 'Wrapper action sample'
|
||||
inputs:
|
||||
name:
|
||||
default: 'GitHub'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'main.js'
|
||||
post: 'cleanup.js'
|
||||
```
|
||||
|
||||
In action's `main.js`:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
core.saveState("pidToKill", 12345);
|
||||
```
|
||||
|
||||
In action's `cleanup.js`:
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
var pid = core.getState("pidToKill");
|
||||
|
||||
process.kill(pid);
|
||||
```
|
||||
21
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/command.d.ts
generated
vendored
21
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/command.d.ts
generated
vendored
@@ -1,21 +0,0 @@
|
||||
interface CommandProperties {
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||
export declare function issue(name: string, message?: string): void;
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
export declare function toCommandValue(input: any): string;
|
||||
export {};
|
||||
92
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/command.js
generated
vendored
92
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/command.js
generated
vendored
@@ -1,92 +0,0 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __importStar(require("os"));
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
process.stdout.write(cmd.toString() + os.EOL);
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
function issue(name, message = '') {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_STRING = '::';
|
||||
class Command {
|
||||
constructor(command, properties, message) {
|
||||
if (!command) {
|
||||
command = 'missing.command';
|
||||
}
|
||||
this.command = command;
|
||||
this.properties = properties;
|
||||
this.message = message;
|
||||
}
|
||||
toString() {
|
||||
let cmdStr = CMD_STRING + this.command;
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
cmdStr += ' ';
|
||||
let first = true;
|
||||
for (const key in this.properties) {
|
||||
if (this.properties.hasOwnProperty(key)) {
|
||||
const val = this.properties[key];
|
||||
if (val) {
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
cmdStr += ',';
|
||||
}
|
||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
function escapeData(s) {
|
||||
return toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/:/g, '%3A')
|
||||
.replace(/,/g, '%2C');
|
||||
}
|
||||
//# sourceMappingURL=command.js.map
|
||||
1
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/command.js.map
generated
vendored
1
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/command.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAWxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,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I,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||
122
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/core.d.ts
generated
vendored
122
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -1,122 +0,0 @@
|
||||
/**
|
||||
* Interface for getInput options
|
||||
*/
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: any): void;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
export declare function setSecret(secret: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function setOutput(name: string, value: any): void;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
export declare function setCommandEcho(enabled: boolean): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string | Error): void;
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
export declare function isDebug(): boolean;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function error(message: string | Error): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function warning(message: string | Error): void;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
export declare function info(message: string): void;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/
|
||||
export declare function startGroup(name: string): void;
|
||||
/**
|
||||
* End an output group.
|
||||
*/
|
||||
export declare function endGroup(): void;
|
||||
/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/
|
||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
||||
/**
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function saveState(name: string, value: any): void;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getState(name: string): string;
|
||||
222
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/core.js
generated
vendored
222
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/core.js
generated
vendored
@@ -1,222 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = require("./command");
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
const convertedVal = command_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
function setSecret(secret) {
|
||||
command_1.issueCommand('add-mask', {}, secret);
|
||||
}
|
||||
exports.setSecret = setSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
function setCommandEcho(enabled) {
|
||||
command_1.issue('echo', enabled ? 'on' : 'off');
|
||||
}
|
||||
exports.setCommandEcho = setCommandEcho;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
function isDebug() {
|
||||
return process.env['RUNNER_DEBUG'] === '1';
|
||||
}
|
||||
exports.isDebug = isDebug;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
function debug(message) {
|
||||
command_1.issueCommand('debug', {}, message);
|
||||
}
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function error(message) {
|
||||
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
function info(message) {
|
||||
process.stdout.write(message + os.EOL);
|
||||
}
|
||||
exports.info = info;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/
|
||||
function startGroup(name) {
|
||||
command_1.issue('group', name);
|
||||
}
|
||||
exports.startGroup = startGroup;
|
||||
/**
|
||||
* End an output group.
|
||||
*/
|
||||
function endGroup() {
|
||||
command_1.issue('endgroup');
|
||||
}
|
||||
exports.endGroup = endGroup;
|
||||
/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/
|
||||
function group(name, fn) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
startGroup(name);
|
||||
let result;
|
||||
try {
|
||||
result = yield fn();
|
||||
}
|
||||
finally {
|
||||
endGroup();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
exports.group = group;
|
||||
//-----------------------------------------------------------------------
|
||||
// Wrapper action state
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function saveState(name, value) {
|
||||
command_1.issueCommand('save-state', { name }, value);
|
||||
}
|
||||
exports.saveState = saveState;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/
|
||||
function getState(name) {
|
||||
return process.env[`STATE_${name}`] || '';
|
||||
}
|
||||
exports.getState = getState;
|
||||
//# sourceMappingURL=core.js.map
|
||||
1
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/core.js.map
generated
vendored
1
node_modules/@actions/tool-cache/node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6D;AAE7D,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,wBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAChC,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;AAC/C,CAAC;AAJD,wCAIC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CA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;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
||||
40
node_modules/@actions/tool-cache/node_modules/@actions/core/package.json
generated
vendored
40
node_modules/@actions/tool-cache/node_modules/@actions/core/package.json
generated
vendored
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "@actions/core",
|
||||
"version": "1.2.4",
|
||||
"description": "Actions core lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"types": "lib/core.d.ts",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
}
|
||||
}
|
||||
10
node_modules/@actions/tool-cache/package.json
generated
vendored
10
node_modules/@actions/tool-cache/package.json
generated
vendored
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@actions/tool-cache",
|
||||
"version": "1.5.5",
|
||||
"version": "1.7.1",
|
||||
"description": "Actions tool-cache lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/tool-cache",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/tool-cache",
|
||||
"license": "MIT",
|
||||
"main": "lib/tool-cache.js",
|
||||
"types": "lib/tool-cache.d.ts",
|
||||
@@ -28,7 +28,7 @@
|
||||
"directory": "packages/tool-cache"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
@@ -36,10 +36,10 @@
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.3",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/http-client": "^1.0.8",
|
||||
"@actions/io": "^1.0.1",
|
||||
"@actions/io": "^1.1.1",
|
||||
"semver": "^6.1.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
|
||||
62
node_modules/array-uniq/index.js
generated
vendored
62
node_modules/array-uniq/index.js
generated
vendored
@@ -1,62 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// there's 3 implementations written in increasing order of efficiency
|
||||
|
||||
// 1 - no Set type is defined
|
||||
function uniqNoSet(arr) {
|
||||
var ret = [];
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (ret.indexOf(arr[i]) === -1) {
|
||||
ret.push(arr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 2 - a simple Set type is defined
|
||||
function uniqSet(arr) {
|
||||
var seen = new Set();
|
||||
return arr.filter(function (el) {
|
||||
if (!seen.has(el)) {
|
||||
seen.add(el);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// 3 - a standard Set type is defined and it has a forEach method
|
||||
function uniqSetWithForEach(arr) {
|
||||
var ret = [];
|
||||
|
||||
(new Set(arr)).forEach(function (el) {
|
||||
ret.push(el);
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// V8 currently has a broken implementation
|
||||
// https://github.com/joyent/node/issues/8449
|
||||
function doesForEachActuallyWork() {
|
||||
var ret = false;
|
||||
|
||||
(new Set([true])).forEach(function (el) {
|
||||
ret = el;
|
||||
});
|
||||
|
||||
return ret === true;
|
||||
}
|
||||
|
||||
if ('Set' in global) {
|
||||
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
|
||||
module.exports = uniqSetWithForEach;
|
||||
} else {
|
||||
module.exports = uniqSet;
|
||||
}
|
||||
} else {
|
||||
module.exports = uniqNoSet;
|
||||
}
|
||||
21
node_modules/array-uniq/license
generated
vendored
21
node_modules/array-uniq/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
37
node_modules/array-uniq/package.json
generated
vendored
37
node_modules/array-uniq/package.json
generated
vendored
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "array-uniq",
|
||||
"version": "1.0.3",
|
||||
"description": "Create an array without duplicates",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/array-uniq",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"array",
|
||||
"arr",
|
||||
"set",
|
||||
"uniq",
|
||||
"unique",
|
||||
"es6",
|
||||
"duplicate",
|
||||
"remove"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"es6-set": "^0.1.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
30
node_modules/array-uniq/readme.md
generated
vendored
30
node_modules/array-uniq/readme.md
generated
vendored
@@ -1,30 +0,0 @@
|
||||
# array-uniq [](https://travis-ci.org/sindresorhus/array-uniq)
|
||||
|
||||
> Create an array without duplicates
|
||||
|
||||
It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save array-uniq
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayUniq = require('array-uniq');
|
||||
|
||||
arrayUniq([1, 1, 2, 3, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUniq(['foo', 'foo', 'bar', 'foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
26
node_modules/github-linguist/dist/languages.js
generated
vendored
26
node_modules/github-linguist/dist/languages.js
generated
vendored
@@ -4,6 +4,15 @@ exports.Languages = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
// tslint:disable-next-line
|
||||
const languageMap = require('language-map');
|
||||
/**
|
||||
* The extension map can contain multiple languages with the same extension,
|
||||
* but we only want a single one. For the moment, these clashes are resolved
|
||||
* by the simple heuristic below listing high-priority languages. We may want
|
||||
* to consider smarter heuristics to correctly identify languages in cases
|
||||
* where the extension is ambiguous. The ordering of the list matters and
|
||||
* languages earlier on will get a higher priority when resolving clashes.
|
||||
*/
|
||||
const importantLanguages = ["javascript", "typescript", "ruby", "python", "java", "c", "c++", "c#", "rust", "scala", "perl", "go"];
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
@@ -34,7 +43,22 @@ class Languages {
|
||||
const languageMode = languageMap[language];
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension) => {
|
||||
extensions[extension.toLowerCase()] = language.toLowerCase();
|
||||
const lowerCaseExtension = extension.toLowerCase();
|
||||
const lowerCaseLanguage = language.toLowerCase();
|
||||
if (!extensions[lowerCaseExtension]) {
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
}
|
||||
else {
|
||||
const currentLanguagePriority = importantLanguages.indexOf(extensions[lowerCaseExtension]);
|
||||
if (currentLanguagePriority === -1) {
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
}
|
||||
else {
|
||||
const otherPriority = importantLanguages.indexOf(lowerCaseLanguage);
|
||||
if (otherPriority !== -1 && otherPriority < currentLanguagePriority)
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return Object.assign({}, extensions, utils_1.ExtensionJustify);
|
||||
|
||||
2
node_modules/github-linguist/dist/languages.js.map
generated
vendored
2
node_modules/github-linguist/dist/languages.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAE3C,2BAA2B;AAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAU5C;;;;;GAKG;AACH,MAAa,SAAS;IAKpB;;OAEG;IACH;QAPA;;;;mBAEI,EAAE;WAAC;QASP;;WAEG;QACH;;;;mBAA2B,GAAG,EAAE;gBAC9B,MAAM,UAAU,GAAoB,EAAE,CAAC;gBAEvC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;oBAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;oBAC3C,MAAM,kBAAkB,GAAG,CAAC,YAAY,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;oBAC3E,kBAAkB,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE;wBAC/C,UAAU,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;oBAC/D,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;gBAEH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,wBAAgB,CAAC,CAAC;YACzD,CAAC;WAAA;QAlBC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC;IAmBD;;;;;;OAMG;IAC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,gCAAgC;QAChC,qBAAqB,EAAE,OAAO;QAE9B,gCAAgC;QAChC,wBAAwB,EAAE,QAAQ;QAElC,uBAAuB;QACvB,4BAA4B,EAAE,MAAM;KACrC;IAED,IAAI,EAAE;QACJ,kCAAkC;QAClC,iBAAiB,EAAE,MAAM;QAEzB,oCAAoC;QACpC,oBAAoB,EAAE,MAAM;QAE5B,oCAAoC;QACpC,yBAAyB,EAAE,OAAO;QAElC,gCAAgC;QAChC,qBAAqB,EAAE,KAAK;QAE5B,gCAAgC;QAChC,wBAAwB,EAAE,MAAM;QAEhC,uBAAuB;QACvB,4BAA4B,EAAE,WAAW;KAC1C;CACF,CAAC"}
|
||||
6
node_modules/github-linguist/node_modules/array-union/index.js
generated
vendored
6
node_modules/github-linguist/node_modules/array-union/index.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
'use strict';
|
||||
var arrayUniq = require('array-uniq');
|
||||
|
||||
module.exports = function () {
|
||||
return arrayUniq([].concat.apply([], arguments));
|
||||
};
|
||||
21
node_modules/github-linguist/node_modules/array-union/license
generated
vendored
21
node_modules/github-linguist/node_modules/array-union/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
40
node_modules/github-linguist/node_modules/array-union/package.json
generated
vendored
40
node_modules/github-linguist/node_modules/array-union/package.json
generated
vendored
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "array-union",
|
||||
"version": "1.0.2",
|
||||
"description": "Create an array of unique values, in order, from the input arrays",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/array-union",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"array",
|
||||
"arr",
|
||||
"set",
|
||||
"uniq",
|
||||
"unique",
|
||||
"duplicate",
|
||||
"remove",
|
||||
"union",
|
||||
"combine",
|
||||
"merge"
|
||||
],
|
||||
"dependencies": {
|
||||
"array-uniq": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
28
node_modules/github-linguist/node_modules/array-union/readme.md
generated
vendored
28
node_modules/github-linguist/node_modules/array-union/readme.md
generated
vendored
@@ -1,28 +0,0 @@
|
||||
# array-union [](https://travis-ci.org/sindresorhus/array-union)
|
||||
|
||||
> Create an array of unique values, in order, from the input arrays
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save array-union
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayUnion = require('array-union');
|
||||
|
||||
arrayUnion([1, 1, 2, 3], [2, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUnion(['foo', 'foo', 'bar'], ['foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
2
node_modules/github-linguist/package.json
generated
vendored
2
node_modules/github-linguist/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "github-linguist",
|
||||
"version": "2.4.2",
|
||||
"version": "2.4.3",
|
||||
"description": "A tool to count lines of code in a repository powered by github-linguist langauge mappings.",
|
||||
"keywords": [
|
||||
"loc",
|
||||
|
||||
26
node_modules/github-linguist/src/languages.ts
generated
vendored
26
node_modules/github-linguist/src/languages.ts
generated
vendored
@@ -11,6 +11,17 @@ interface ExtensionsTypes {
|
||||
|
||||
export interface DetectorOptions {}
|
||||
|
||||
/**
|
||||
* The extension map can contain multiple languages with the same extension,
|
||||
* but we only want a single one. For the moment, these clashes are resolved
|
||||
* by the simple heuristic below listing high-priority languages. We may want
|
||||
* to consider smarter heuristics to correctly identify languages in cases
|
||||
* where the extension is ambiguous. The ordering of the list matters and
|
||||
* languages earlier on will get a higher priority when resolving clashes.
|
||||
*/
|
||||
const importantLanguages = ["javascript", "typescript", "ruby", "python", "java", "c", "c++", "c#", "rust", "scala", "perl", "go"];
|
||||
|
||||
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
@@ -39,7 +50,20 @@ export class Languages {
|
||||
const languageMode = languageMap[language];
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension: string) => {
|
||||
extensions[extension.toLowerCase()] = language.toLowerCase();
|
||||
const lowerCaseExtension = extension.toLowerCase();
|
||||
const lowerCaseLanguage = language.toLowerCase()
|
||||
if (!extensions[lowerCaseExtension]) {
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
} else {
|
||||
const currentLanguagePriority = importantLanguages.indexOf(extensions[lowerCaseExtension]);
|
||||
if (currentLanguagePriority === -1) {
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
} else {
|
||||
const otherPriority = importantLanguages.indexOf(lowerCaseLanguage);
|
||||
if (otherPriority !== -1 && otherPriority < currentLanguagePriority)
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
118
node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
118
node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366))
|
||||
|
||||
### [6.0.1](https://www.github.com/gulpjs/glob-parent/compare/v6.0.0...v6.0.1) (2021-07-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Resolve ReDoS vulnerability from CVE-2021-35065 ([#49](https://www.github.com/gulpjs/glob-parent/issues/49)) ([3e9f04a](https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339))
|
||||
|
||||
## [6.0.0](https://www.github.com/gulpjs/glob-parent/compare/v5.1.2...v6.0.0) (2021-05-03)
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
- Correct mishandled escaped path separators (#34)
|
||||
- upgrade scaffold, dropping node <10 support
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Correct mishandled escaped path separators ([#34](https://www.github.com/gulpjs/glob-parent/issues/34)) ([32f6d52](https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47)), closes [#32](https://www.github.com/gulpjs/glob-parent/issues/32)
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
- upgrade scaffold, dropping node <10 support ([e83d0c5](https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f))
|
||||
|
||||
### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb))
|
||||
|
||||
## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27)
|
||||
|
||||
### Features
|
||||
|
||||
- add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3))
|
||||
|
||||
## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27)
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
- Drop support for node <6 & bump dependencies
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
- Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a))
|
||||
|
||||
## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27)
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
- question marks are valid path characters on Windows so avoid flagging as a glob when alone
|
||||
- Update is-glob dependency
|
||||
|
||||
### Features
|
||||
|
||||
- hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e))
|
||||
- question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841))
|
||||
- Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281))
|
||||
|
||||
## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27)
|
||||
|
||||
### Features
|
||||
|
||||
- allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b))
|
||||
- handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd))
|
||||
- new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be))
|
||||
- pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388))
|
||||
- preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf))
|
||||
|
||||
### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27)
|
||||
|
||||
### Features
|
||||
|
||||
- use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030))
|
||||
|
||||
## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27)
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
- update is-glob dependency
|
||||
|
||||
### Features
|
||||
|
||||
- update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd))
|
||||
|
||||
## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27)
|
||||
|
||||
### Features
|
||||
|
||||
- move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2))
|
||||
|
||||
## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27)
|
||||
|
||||
## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27)
|
||||
|
||||
### Reverts
|
||||
|
||||
- feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0))
|
||||
|
||||
## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27)
|
||||
|
||||
### Features
|
||||
|
||||
- make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233))
|
||||
|
||||
## 1.0.0 (2021-01-27)
|
||||
2
node_modules/glob-parent/LICENSE
generated
vendored
2
node_modules/glob-parent/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker
|
||||
Copyright (c) 2015, 2019 Elan Shanker, 2021 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
||||
49
node_modules/glob-parent/README.md
generated
vendored
49
node_modules/glob-parent/README.md
generated
vendored
@@ -6,7 +6,7 @@
|
||||
|
||||
# glob-parent
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Extract the non-magic parent path from a glob string.
|
||||
|
||||
@@ -45,7 +45,7 @@ Takes a string and returns the part of the path before the glob begins. Be aware
|
||||
```js
|
||||
{
|
||||
// Disables the automatic conversion of slashes for Windows
|
||||
flipBackslashes: true
|
||||
flipBackslashes: true;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -66,13 +66,14 @@ The following characters have special significance in glob patterns and must be
|
||||
**Example**
|
||||
|
||||
```js
|
||||
globParent('foo/[bar]/') // 'foo'
|
||||
globParent('foo/\\[bar]/') // 'foo/[bar]'
|
||||
globParent('foo/[bar]/'); // 'foo'
|
||||
globParent('foo/\\[bar]/'); // 'foo/[bar]'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
### Braces & Brackets
|
||||
|
||||
This library attempts a quick and imperfect method of determining which path
|
||||
parts have glob magic without fully parsing/lexing the pattern. There are some
|
||||
advanced use cases that can trip it up, such as nested braces where the outer
|
||||
@@ -82,6 +83,7 @@ ensure higher-fidelity glob handling in your library, it is recommended that you
|
||||
pre-process your input with [expand-braces] and/or [expand-brackets].
|
||||
|
||||
### Windows
|
||||
|
||||
Backslashes are not valid path separators for globs. If a path with backslashes
|
||||
is provided anyway, for simple cases, glob-parent will replace the path
|
||||
separator for you and return the non-glob parent path (now with
|
||||
@@ -91,10 +93,10 @@ This cannot be used in conjunction with escape characters.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)'
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext'); // 'C:/Program Files /(x86/)'
|
||||
|
||||
// GOOD
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)'
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext'); // 'C:/Program Files (x86)'
|
||||
```
|
||||
|
||||
If you are using escape characters for a pattern without path parts (i.e.
|
||||
@@ -102,36 +104,31 @@ relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('foo \\[bar]') // 'foo '
|
||||
globParent('foo \\[bar]*') // 'foo '
|
||||
globParent('foo \\[bar]'); // 'foo '
|
||||
globParent('foo \\[bar]*'); // 'foo '
|
||||
|
||||
// GOOD
|
||||
globParent('./foo \\[bar]') // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*') // '.'
|
||||
globParent('./foo \\[bar]'); // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*'); // '.'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
|
||||
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg
|
||||
<!-- prettier-ignore-start -->
|
||||
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/glob-parent
|
||||
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg
|
||||
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg?style=flat-square
|
||||
|
||||
[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master
|
||||
[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master
|
||||
|
||||
[travis-url]: https://travis-ci.org/gulpjs/glob-parent
|
||||
[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci
|
||||
|
||||
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor
|
||||
[ci-url]: https://github.com/gulpjs/glob-parent/actions?query=workflow:dev
|
||||
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glob-parent/dev?style=flat-square
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg?style=flat-square
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
[gitter-url]: https://gitter.im/gulpjs/gulp
|
||||
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|
||||
<!-- prettier-ignore-start -->
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
30
node_modules/glob-parent/index.js
generated
vendored
30
node_modules/glob-parent/index.js
generated
vendored
@@ -6,9 +6,8 @@ var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
var slash = '/';
|
||||
var backslash = /\\/g;
|
||||
var enclosure = /[\{\[].*[\/]*.*[\}\]]$/;
|
||||
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
||||
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
||||
var globby = /(^|[^\\])([{[]|\([^)]+$)/;
|
||||
var escaped = /\\([!*?|[\](){}])/g;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
@@ -24,7 +23,7 @@ module.exports = function globParent(str, opts) {
|
||||
}
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (enclosure.test(str)) {
|
||||
if (isEnclosure(str)) {
|
||||
str += slash;
|
||||
}
|
||||
|
||||
@@ -39,3 +38,26 @@ module.exports = function globParent(str, opts) {
|
||||
// remove escape chars and return result
|
||||
return str.replace(escaped, '$1');
|
||||
};
|
||||
|
||||
function isEnclosure(str) {
|
||||
var lastChar = str.slice(-1);
|
||||
|
||||
var enclosureStart;
|
||||
switch (lastChar) {
|
||||
case '}':
|
||||
enclosureStart = '{';
|
||||
break;
|
||||
case ']':
|
||||
enclosureStart = '[';
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
var foundIndex = str.indexOf(enclosureStart);
|
||||
if (foundIndex < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str.slice(foundIndex + 1, -1).includes(slash);
|
||||
}
|
||||
|
||||
28
node_modules/glob-parent/package.json
generated
vendored
28
node_modules/glob-parent/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "glob-parent",
|
||||
"version": "5.1.1",
|
||||
"version": "6.0.1",
|
||||
"description": "Extract the non-magic parent path from a glob string.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
||||
"contributors": [
|
||||
@@ -10,7 +10,7 @@
|
||||
"repository": "gulpjs/glob-parent",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
@@ -20,20 +20,26 @@
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "nyc mocha --async-only",
|
||||
"azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit",
|
||||
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||
"test": "nyc mocha --async-only"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.11",
|
||||
"eslint": "^2.13.1",
|
||||
"eslint-config-gulp": "^3.0.1",
|
||||
"expect": "^1.20.2",
|
||||
"mocha": "^6.0.2",
|
||||
"nyc": "^13.3.0"
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-gulp": "^5.0.0",
|
||||
"expect": "^26.0.1",
|
||||
"mocha": "^7.1.2",
|
||||
"nyc": "^15.0.1"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
|
||||
457
node_modules/normalize-url/index.d.ts
generated
vendored
457
node_modules/normalize-url/index.d.ts
generated
vendored
@@ -1,216 +1,263 @@
|
||||
declare namespace normalizeUrl {
|
||||
interface Options {
|
||||
/**
|
||||
@default 'http:'
|
||||
*/
|
||||
readonly defaultProtocol?: string;
|
||||
|
||||
/**
|
||||
Prepends `defaultProtocol` to the URL if it's protocol-relative.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('//sindresorhus.com:80/');
|
||||
//=> 'http://sindresorhus.com'
|
||||
|
||||
normalizeUrl('//sindresorhus.com:80/', {normalizeProtocol: false});
|
||||
//=> '//sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly normalizeProtocol?: boolean;
|
||||
|
||||
/**
|
||||
Normalizes `https:` URLs to `http:`.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com:80/');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('https://sindresorhus.com:80/', {forceHttp: true});
|
||||
//=> 'http://sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly forceHttp?: boolean;
|
||||
|
||||
/**
|
||||
Normalizes `http:` URLs to `https:`.
|
||||
|
||||
This option can't be used with the `forceHttp` option at the same time.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com:80/');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com:80/', {forceHttps: true});
|
||||
//=> 'https://sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly forceHttps?: boolean;
|
||||
|
||||
/**
|
||||
Strip the [authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) part of a URL.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('user:password@sindresorhus.com');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('user:password@sindresorhus.com', {stripAuthentication: false});
|
||||
//=> 'https://user:password@sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly stripAuthentication?: boolean;
|
||||
|
||||
/**
|
||||
Removes hash from the URL.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('sindresorhus.com/about.html#contact');
|
||||
//=> 'http://sindresorhus.com/about.html#contact'
|
||||
|
||||
normalizeUrl('sindresorhus.com/about.html#contact', {stripHash: true});
|
||||
//=> 'http://sindresorhus.com/about.html'
|
||||
```
|
||||
*/
|
||||
readonly stripHash?: boolean;
|
||||
|
||||
/**
|
||||
Removes HTTP(S) protocol from an URL `http://sindresorhus.com` → `sindresorhus.com`.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('sindresorhus.com', {stripProtocol: true});
|
||||
//=> 'sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly stripProtocol?: boolean;
|
||||
|
||||
/**
|
||||
Removes `www.` from the URL.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('http://www.sindresorhus.com');
|
||||
//=> 'http://sindresorhus.com'
|
||||
|
||||
normalizeUrl('http://www.sindresorhus.com', {stripWWW: false});
|
||||
//=> 'http://www.sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly stripWWW?: boolean;
|
||||
|
||||
/**
|
||||
Removes query parameters that matches any of the provided strings or regexes.
|
||||
|
||||
@default [/^utm_\w+/i]
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
|
||||
removeQueryParameters: ['ref']
|
||||
});
|
||||
//=> 'http://sindresorhus.com/?foo=bar'
|
||||
```
|
||||
*/
|
||||
readonly removeQueryParameters?: ReadonlyArray<RegExp | string>;
|
||||
|
||||
/**
|
||||
Removes trailing slash.
|
||||
|
||||
__Note__: Trailing slash is always removed if the URL doesn't have a pathname.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('http://sindresorhus.com/redirect/');
|
||||
//=> 'http://sindresorhus.com/redirect'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/redirect/', {removeTrailingSlash: false});
|
||||
//=> 'http://sindresorhus.com/redirect/'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/', {removeTrailingSlash: false});
|
||||
//=> 'http://sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly removeTrailingSlash?: boolean;
|
||||
|
||||
/**
|
||||
Removes the default directory index file from path that matches any of the provided strings or regexes.
|
||||
When `true`, the regex `/^index\.[a-z]+$/` is used.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com/foo/default.php', {
|
||||
removeDirectoryIndex: [/^default\.[a-z]+$/]
|
||||
});
|
||||
//=> 'http://sindresorhus.com/foo'
|
||||
```
|
||||
*/
|
||||
readonly removeDirectoryIndex?: ReadonlyArray<RegExp | string>;
|
||||
|
||||
/**
|
||||
Sorts the query parameters alphabetically by key.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com?b=two&a=one&c=three', {
|
||||
sortQueryParameters: false
|
||||
});
|
||||
//=> 'http://sindresorhus.com/?b=two&a=one&c=three'
|
||||
```
|
||||
*/
|
||||
readonly sortQueryParameters?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const normalizeUrl: {
|
||||
export interface Options {
|
||||
/**
|
||||
[Normalize](https://en.wikipedia.org/wiki/URL_normalization) a URL.
|
||||
@default 'http:'
|
||||
*/
|
||||
readonly defaultProtocol?: string;
|
||||
|
||||
@param url - URL to normalize, including [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).
|
||||
/**
|
||||
Prepends `defaultProtocol` to the URL if it's protocol-relative.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
import normalizeUrl = require('normalize-url');
|
||||
|
||||
normalizeUrl('sindresorhus.com');
|
||||
normalizeUrl('//sindresorhus.com:80/');
|
||||
//=> 'http://sindresorhus.com'
|
||||
|
||||
normalizeUrl('HTTP://xn--xample-hva.com:80/?b=bar&a=foo');
|
||||
//=> 'http://êxample.com/?a=foo&b=bar'
|
||||
normalizeUrl('//sindresorhus.com:80/', {normalizeProtocol: false});
|
||||
//=> '//sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
(url: string, options?: normalizeUrl.Options): string;
|
||||
readonly normalizeProtocol?: boolean;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function normalizeUrl(url: string, options?: normalizeUrl.Options): string;
|
||||
// export = normalizeUrl;
|
||||
default: typeof normalizeUrl;
|
||||
};
|
||||
/**
|
||||
Normalizes `https:` URLs to `http:`.
|
||||
|
||||
export = normalizeUrl;
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com:80/');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('https://sindresorhus.com:80/', {forceHttp: true});
|
||||
//=> 'http://sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly forceHttp?: boolean;
|
||||
|
||||
/**
|
||||
Normalizes `http:` URLs to `https:`.
|
||||
|
||||
This option can't be used with the `forceHttp` option at the same time.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com:80/');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com:80/', {forceHttps: true});
|
||||
//=> 'https://sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly forceHttps?: boolean;
|
||||
|
||||
/**
|
||||
Strip the [authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) part of a URL.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('user:password@sindresorhus.com');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('user:password@sindresorhus.com', {stripAuthentication: false});
|
||||
//=> 'https://user:password@sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly stripAuthentication?: boolean;
|
||||
|
||||
/**
|
||||
Removes hash from the URL.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('sindresorhus.com/about.html#contact');
|
||||
//=> 'http://sindresorhus.com/about.html#contact'
|
||||
|
||||
normalizeUrl('sindresorhus.com/about.html#contact', {stripHash: true});
|
||||
//=> 'http://sindresorhus.com/about.html'
|
||||
```
|
||||
*/
|
||||
readonly stripHash?: boolean;
|
||||
|
||||
/**
|
||||
Removes HTTP(S) protocol from an URL `http://sindresorhus.com` → `sindresorhus.com`.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('sindresorhus.com', {stripProtocol: true});
|
||||
//=> 'sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly stripProtocol?: boolean;
|
||||
|
||||
/**
|
||||
Strip the [text fragment](https://web.dev/text-fragments/) part of the URL
|
||||
|
||||
__Note:__ The text fragment will always be removed if the `stripHash` option is set to `true`, as the hash contains the text fragment.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('http://sindresorhus.com/about.html#:~:text=hello');
|
||||
//=> 'http://sindresorhus.com/about.html#'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/about.html#section:~:text=hello');
|
||||
//=> 'http://sindresorhus.com/about.html#section'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/about.html#:~:text=hello', {stripTextFragment: false});
|
||||
//=> 'http://sindresorhus.com/about.html#:~:text=hello'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/about.html#section:~:text=hello', {stripTextFragment: false});
|
||||
//=> 'http://sindresorhus.com/about.html#section:~:text=hello'
|
||||
```
|
||||
*/
|
||||
readonly stripTextFragment?: boolean;
|
||||
|
||||
/**
|
||||
Removes `www.` from the URL.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('http://www.sindresorhus.com');
|
||||
//=> 'http://sindresorhus.com'
|
||||
|
||||
normalizeUrl('http://www.sindresorhus.com', {stripWWW: false});
|
||||
//=> 'http://www.sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly stripWWW?: boolean;
|
||||
|
||||
/**
|
||||
Removes query parameters that matches any of the provided strings or regexes.
|
||||
|
||||
@default [/^utm_\w+/i]
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
|
||||
removeQueryParameters: ['ref']
|
||||
});
|
||||
//=> 'http://sindresorhus.com/?foo=bar'
|
||||
```
|
||||
|
||||
If a boolean is provided, `true` will remove all the query parameters.
|
||||
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com?foo=bar', {
|
||||
removeQueryParameters: true
|
||||
});
|
||||
//=> 'http://sindresorhus.com'
|
||||
```
|
||||
|
||||
`false` will not remove any query parameter.
|
||||
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com?foo=bar&utm_medium=test&ref=test_ref', {
|
||||
removeQueryParameters: false
|
||||
});
|
||||
//=> 'http://www.sindresorhus.com/?foo=bar&ref=test_ref&utm_medium=test'
|
||||
```
|
||||
*/
|
||||
readonly removeQueryParameters?: ReadonlyArray<RegExp | string> | boolean;
|
||||
|
||||
/**
|
||||
Removes trailing slash.
|
||||
|
||||
__Note__: Trailing slash is always removed if the URL doesn't have a pathname unless the `removeSingleSlash` option is set to `false`.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('http://sindresorhus.com/redirect/');
|
||||
//=> 'http://sindresorhus.com/redirect'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/redirect/', {removeTrailingSlash: false});
|
||||
//=> 'http://sindresorhus.com/redirect/'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com/', {removeTrailingSlash: false});
|
||||
//=> 'http://sindresorhus.com'
|
||||
```
|
||||
*/
|
||||
readonly removeTrailingSlash?: boolean;
|
||||
|
||||
/**
|
||||
Remove a sole `/` pathname in the output. This option is independant of `removeTrailingSlash`.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('https://sindresorhus.com/');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('https://sindresorhus.com/', {removeSingleSlash: false});
|
||||
//=> 'https://sindresorhus.com/'
|
||||
```
|
||||
*/
|
||||
readonly removeSingleSlash?: boolean;
|
||||
|
||||
/**
|
||||
Removes the default directory index file from path that matches any of the provided strings or regexes.
|
||||
When `true`, the regex `/^index\.[a-z]+$/` is used.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com/foo/default.php', {
|
||||
removeDirectoryIndex: [/^default\.[a-z]+$/]
|
||||
});
|
||||
//=> 'http://sindresorhus.com/foo'
|
||||
```
|
||||
*/
|
||||
readonly removeDirectoryIndex?: ReadonlyArray<RegExp | string>;
|
||||
|
||||
/**
|
||||
Sorts the query parameters alphabetically by key.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
normalizeUrl('www.sindresorhus.com?b=two&a=one&c=three', {
|
||||
sortQueryParameters: false
|
||||
});
|
||||
//=> 'http://sindresorhus.com/?b=two&a=one&c=three'
|
||||
```
|
||||
*/
|
||||
readonly sortQueryParameters?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
[Normalize](https://en.wikipedia.org/wiki/URL_normalization) a URL.
|
||||
|
||||
@param url - URL to normalize, including [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).
|
||||
|
||||
@example
|
||||
```
|
||||
import normalizeUrl from 'normalize-url';
|
||||
|
||||
normalizeUrl('sindresorhus.com');
|
||||
//=> 'http://sindresorhus.com'
|
||||
|
||||
normalizeUrl('//www.sindresorhus.com:80/../baz?b=bar&a=foo');
|
||||
//=> 'http://sindresorhus.com/baz?a=foo&b=bar'
|
||||
```
|
||||
*/
|
||||
export default function normalizeUrl(url: string, options?: Options): string;
|
||||
|
||||
141
node_modules/normalize-url/index.js
generated
vendored
141
node_modules/normalize-url/index.js
generated
vendored
@@ -1,31 +1,24 @@
|
||||
'use strict';
|
||||
// TODO: Use the `URL` global when targeting Node.js 10
|
||||
const URLParser = typeof URL === 'undefined' ? require('url').URL : URL;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
|
||||
const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';
|
||||
const DATA_URL_DEFAULT_CHARSET = 'us-ascii';
|
||||
|
||||
const testParameter = (name, filters) => {
|
||||
return filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);
|
||||
};
|
||||
const testParameter = (name, filters) => filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);
|
||||
|
||||
const normalizeDataURL = (urlString, {stripHash}) => {
|
||||
const parts = urlString.match(/^data:(.*?),(.*?)(?:#(.*))?$/);
|
||||
const match = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(urlString);
|
||||
|
||||
if (!parts) {
|
||||
if (!match) {
|
||||
throw new Error(`Invalid URL: ${urlString}`);
|
||||
}
|
||||
|
||||
const mediaType = parts[1].split(';');
|
||||
const body = parts[2];
|
||||
const hash = stripHash ? '' : parts[3];
|
||||
|
||||
let base64 = false;
|
||||
let {type, data, hash} = match.groups;
|
||||
const mediaType = type.split(';');
|
||||
hash = stripHash ? '' : hash;
|
||||
|
||||
let isBase64 = false;
|
||||
if (mediaType[mediaType.length - 1] === 'base64') {
|
||||
mediaType.pop();
|
||||
base64 = true;
|
||||
isBase64 = true;
|
||||
}
|
||||
|
||||
// Lowercase MIME type
|
||||
@@ -48,21 +41,21 @@ const normalizeDataURL = (urlString, {stripHash}) => {
|
||||
.filter(Boolean);
|
||||
|
||||
const normalizedMediaType = [
|
||||
...attributes
|
||||
...attributes,
|
||||
];
|
||||
|
||||
if (base64) {
|
||||
if (isBase64) {
|
||||
normalizedMediaType.push('base64');
|
||||
}
|
||||
|
||||
if (normalizedMediaType.length !== 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) {
|
||||
if (normalizedMediaType.length > 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) {
|
||||
normalizedMediaType.unshift(mimeType);
|
||||
}
|
||||
|
||||
return `data:${normalizedMediaType.join(';')},${base64 ? body.trim() : body}${hash ? `#${hash}` : ''}`;
|
||||
return `data:${normalizedMediaType.join(';')},${isBase64 ? data.trim() : data}${hash ? `#${hash}` : ''}`;
|
||||
};
|
||||
|
||||
const normalizeUrl = (urlString, options) => {
|
||||
export default function normalizeUrl(urlString, options) {
|
||||
options = {
|
||||
defaultProtocol: 'http:',
|
||||
normalizeProtocol: true,
|
||||
@@ -70,27 +63,16 @@ const normalizeUrl = (urlString, options) => {
|
||||
forceHttps: false,
|
||||
stripAuthentication: true,
|
||||
stripHash: false,
|
||||
stripTextFragment: true,
|
||||
stripWWW: true,
|
||||
removeQueryParameters: [/^utm_\w+/i],
|
||||
removeTrailingSlash: true,
|
||||
removeSingleSlash: true,
|
||||
removeDirectoryIndex: false,
|
||||
sortQueryParameters: true,
|
||||
...options
|
||||
...options,
|
||||
};
|
||||
|
||||
// TODO: Remove this at some point in the future
|
||||
if (Reflect.has(options, 'normalizeHttps')) {
|
||||
throw new Error('options.normalizeHttps is renamed to options.forceHttp');
|
||||
}
|
||||
|
||||
if (Reflect.has(options, 'normalizeHttp')) {
|
||||
throw new Error('options.normalizeHttp is renamed to options.forceHttps');
|
||||
}
|
||||
|
||||
if (Reflect.has(options, 'stripFragment')) {
|
||||
throw new Error('options.stripFragment is renamed to options.stripHash');
|
||||
}
|
||||
|
||||
urlString = urlString.trim();
|
||||
|
||||
// Data URL
|
||||
@@ -98,6 +80,10 @@ const normalizeUrl = (urlString, options) => {
|
||||
return normalizeDataURL(urlString, options);
|
||||
}
|
||||
|
||||
if (/^view-source:/i.test(urlString)) {
|
||||
throw new Error('`view-source:` is not supported as it is a non-standard protocol');
|
||||
}
|
||||
|
||||
const hasRelativeProtocol = urlString.startsWith('//');
|
||||
const isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(urlString);
|
||||
|
||||
@@ -106,47 +92,43 @@ const normalizeUrl = (urlString, options) => {
|
||||
urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, options.defaultProtocol);
|
||||
}
|
||||
|
||||
const urlObj = new URLParser(urlString);
|
||||
const urlObject = new URL(urlString);
|
||||
|
||||
if (options.forceHttp && options.forceHttps) {
|
||||
throw new Error('The `forceHttp` and `forceHttps` options cannot be used together');
|
||||
}
|
||||
|
||||
if (options.forceHttp && urlObj.protocol === 'https:') {
|
||||
urlObj.protocol = 'http:';
|
||||
if (options.forceHttp && urlObject.protocol === 'https:') {
|
||||
urlObject.protocol = 'http:';
|
||||
}
|
||||
|
||||
if (options.forceHttps && urlObj.protocol === 'http:') {
|
||||
urlObj.protocol = 'https:';
|
||||
if (options.forceHttps && urlObject.protocol === 'http:') {
|
||||
urlObject.protocol = 'https:';
|
||||
}
|
||||
|
||||
// Remove auth
|
||||
if (options.stripAuthentication) {
|
||||
urlObj.username = '';
|
||||
urlObj.password = '';
|
||||
urlObject.username = '';
|
||||
urlObject.password = '';
|
||||
}
|
||||
|
||||
// Remove hash
|
||||
if (options.stripHash) {
|
||||
urlObj.hash = '';
|
||||
urlObject.hash = '';
|
||||
} else if (options.stripTextFragment) {
|
||||
urlObject.hash = urlObject.hash.replace(/#?:~:text.*?$/i, '');
|
||||
}
|
||||
|
||||
// Remove duplicate slashes if not preceded by a protocol
|
||||
if (urlObj.pathname) {
|
||||
// TODO: Use the following instead when targeting Node.js 10
|
||||
// `urlObj.pathname = urlObj.pathname.replace(/(?<!https?:)\/{2,}/g, '/');`
|
||||
urlObj.pathname = urlObj.pathname.replace(/((?!:).|^)\/{2,}/g, (_, p1) => {
|
||||
if (/^(?!\/)/g.test(p1)) {
|
||||
return `${p1}/`;
|
||||
}
|
||||
|
||||
return '/';
|
||||
});
|
||||
if (urlObject.pathname) {
|
||||
urlObject.pathname = urlObject.pathname.replace(/(?<!\b[a-z][a-z\d+\-.]{1,50}:)\/{2,}/g, '/');
|
||||
}
|
||||
|
||||
// Decode URI octets
|
||||
if (urlObj.pathname) {
|
||||
urlObj.pathname = decodeURI(urlObj.pathname);
|
||||
if (urlObject.pathname) {
|
||||
try {
|
||||
urlObject.pathname = decodeURI(urlObject.pathname);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// Remove directory index
|
||||
@@ -155,51 +137,62 @@ const normalizeUrl = (urlString, options) => {
|
||||
}
|
||||
|
||||
if (Array.isArray(options.removeDirectoryIndex) && options.removeDirectoryIndex.length > 0) {
|
||||
let pathComponents = urlObj.pathname.split('/');
|
||||
let pathComponents = urlObject.pathname.split('/');
|
||||
const lastComponent = pathComponents[pathComponents.length - 1];
|
||||
|
||||
if (testParameter(lastComponent, options.removeDirectoryIndex)) {
|
||||
pathComponents = pathComponents.slice(0, pathComponents.length - 1);
|
||||
urlObj.pathname = pathComponents.slice(1).join('/') + '/';
|
||||
pathComponents = pathComponents.slice(0, -1);
|
||||
urlObject.pathname = pathComponents.slice(1).join('/') + '/';
|
||||
}
|
||||
}
|
||||
|
||||
if (urlObj.hostname) {
|
||||
if (urlObject.hostname) {
|
||||
// Remove trailing dot
|
||||
urlObj.hostname = urlObj.hostname.replace(/\.$/, '');
|
||||
urlObject.hostname = urlObject.hostname.replace(/\.$/, '');
|
||||
|
||||
// Remove `www.`
|
||||
if (options.stripWWW && /^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(urlObj.hostname)) {
|
||||
// Each label should be max 63 at length (min: 2).
|
||||
// The extension should be max 5 at length (min: 2).
|
||||
if (options.stripWWW && /^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(urlObject.hostname)) {
|
||||
// Each label should be max 63 at length (min: 1).
|
||||
// Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
|
||||
urlObj.hostname = urlObj.hostname.replace(/^www\./, '');
|
||||
// Each TLD should be up to 63 characters long (min: 2).
|
||||
// It is technically possible to have a single character TLD, but none currently exist.
|
||||
urlObject.hostname = urlObject.hostname.replace(/^www\./, '');
|
||||
}
|
||||
}
|
||||
|
||||
// Remove query unwanted parameters
|
||||
if (Array.isArray(options.removeQueryParameters)) {
|
||||
for (const key of [...urlObj.searchParams.keys()]) {
|
||||
for (const key of [...urlObject.searchParams.keys()]) {
|
||||
if (testParameter(key, options.removeQueryParameters)) {
|
||||
urlObj.searchParams.delete(key);
|
||||
urlObject.searchParams.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options.removeQueryParameters === true) {
|
||||
urlObject.search = '';
|
||||
}
|
||||
|
||||
// Sort query parameters
|
||||
if (options.sortQueryParameters) {
|
||||
urlObj.searchParams.sort();
|
||||
urlObject.searchParams.sort();
|
||||
}
|
||||
|
||||
if (options.removeTrailingSlash) {
|
||||
urlObj.pathname = urlObj.pathname.replace(/\/$/, '');
|
||||
urlObject.pathname = urlObject.pathname.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
// Take advantage of many of the Node `url` normalizations
|
||||
urlString = urlObj.toString();
|
||||
const oldUrlString = urlString;
|
||||
|
||||
// Remove ending `/`
|
||||
if ((options.removeTrailingSlash || urlObj.pathname === '/') && urlObj.hash === '') {
|
||||
// Take advantage of many of the Node `url` normalizations
|
||||
urlString = urlObject.toString();
|
||||
|
||||
if (!options.removeSingleSlash && urlObject.pathname === '/' && !oldUrlString.endsWith('/') && urlObject.hash === '') {
|
||||
urlString = urlString.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
// Remove ending `/` unless removeSingleSlash is false
|
||||
if ((options.removeTrailingSlash || urlObject.pathname === '/') && urlObject.hash === '' && options.removeSingleSlash) {
|
||||
urlString = urlString.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
@@ -214,8 +207,4 @@ const normalizeUrl = (urlString, options) => {
|
||||
}
|
||||
|
||||
return urlString;
|
||||
};
|
||||
|
||||
module.exports = normalizeUrl;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = normalizeUrl;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user