mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 17:20:10 +08:00
Compare commits
115 Commits
nickfyson/
...
codeql-bun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1e2c9b8bd | ||
|
|
d81cc671c0 | ||
|
|
3630a78d1a | ||
|
|
b185050563 | ||
|
|
28a5b954e7 | ||
|
|
5cdfcab4d4 | ||
|
|
11c1460003 | ||
|
|
14192f8248 | ||
|
|
d0afe926eb | ||
|
|
0907cd5a41 | ||
|
|
a1fc3a5e79 | ||
|
|
55eb02cb0a | ||
|
|
4ce302bdb9 | ||
|
|
1a91a0716f | ||
|
|
319881ca28 | ||
|
|
a89f5ee6fd | ||
|
|
31e2458574 | ||
|
|
fe8c48ed50 | ||
|
|
f49e963057 | ||
|
|
4290eabf33 | ||
|
|
7073967e9a | ||
|
|
bf60ce880e | ||
|
|
4ff6c0d0c9 | ||
|
|
6d01157d11 | ||
|
|
10479a214a | ||
|
|
122c9b7f24 | ||
|
|
b9e933968b | ||
|
|
62f25fda9b | ||
|
|
d5029a8680 | ||
|
|
dbecf76db8 | ||
|
|
47fa956a52 | ||
|
|
8200c137dc | ||
|
|
228546a1e5 | ||
|
|
bb6fa8ee6d | ||
|
|
2d6f6077bf | ||
|
|
4e39b768c7 | ||
|
|
5e2245cc23 | ||
|
|
67ddca1d9c | ||
|
|
206e34cbb4 | ||
|
|
c4dc1b0438 | ||
|
|
2841489ddf | ||
|
|
a2931d32c7 | ||
|
|
bcf29b3c36 | ||
|
|
c68c97e2bd | ||
|
|
18312707fe | ||
|
|
476bf863f2 | ||
|
|
5419fcd735 | ||
|
|
dffce9945c | ||
|
|
6645c550ef | ||
|
|
34955967b7 | ||
|
|
147734591c | ||
|
|
f2e557e77f | ||
|
|
5d00d5b4e8 | ||
|
|
d9f39334ae | ||
|
|
38363a1043 | ||
|
|
80b408e704 | ||
|
|
481f3ce214 | ||
|
|
2f4ca98eb6 | ||
|
|
23a1a65b43 | ||
|
|
3b90db98f9 | ||
|
|
41464b1396 | ||
|
|
367ad73efb | ||
|
|
8d26f6175d | ||
|
|
31c2eca167 | ||
|
|
427c79f43f | ||
|
|
c36848d44b | ||
|
|
590fdcd891 | ||
|
|
e67ba57e65 | ||
|
|
bba73b6d4e | ||
|
|
cc0eb452c7 | ||
|
|
a8a62974b3 | ||
|
|
d265935d24 | ||
|
|
47eb668155 | ||
|
|
1154bf6df9 | ||
|
|
4666a0eed0 | ||
|
|
b2dfa6e690 | ||
|
|
def00916ce | ||
|
|
9ed519fa12 | ||
|
|
55458a1ab1 | ||
|
|
1dc1029baf | ||
|
|
5166e750e9 | ||
|
|
875a8da7e3 | ||
|
|
ade519b950 | ||
|
|
7795860c11 | ||
|
|
b4a8cfa05c | ||
|
|
7da583bcb3 | ||
|
|
c9b06117cb | ||
|
|
4b4f9e8e6a | ||
|
|
2c94a7f61f | ||
|
|
5f592775cc | ||
|
|
ef3b75cbdb | ||
|
|
090a7013dd | ||
|
|
4c4114f2d8 | ||
|
|
7be1a410c2 | ||
|
|
c1cee53da5 | ||
|
|
d88fa5cef6 | ||
|
|
f6894d6610 | ||
|
|
3d5127d682 | ||
|
|
4076e23ec5 | ||
|
|
0da3e94867 | ||
|
|
3325da8a15 | ||
|
|
121fd331cd | ||
|
|
50d46f662f | ||
|
|
4ab5cbcc8a | ||
|
|
1b20fa78be | ||
|
|
7fc41c62be | ||
|
|
5701037850 | ||
|
|
52274f1815 | ||
|
|
8cea21575c | ||
|
|
0539269665 | ||
|
|
3901848a2f | ||
|
|
b8f7e0ff0f | ||
|
|
06fb4821bc | ||
|
|
ce75b488a5 | ||
|
|
9494a25e76 |
@@ -18,15 +18,18 @@
|
|||||||
"import/no-amd": "error",
|
"import/no-amd": "error",
|
||||||
"import/no-commonjs": "error",
|
"import/no-commonjs": "error",
|
||||||
"import/no-dynamic-require": "error",
|
"import/no-dynamic-require": "error",
|
||||||
"import/no-extraneous-dependencies": ["error", {"devDependencies": false}],
|
"import/no-extraneous-dependencies": ["error"],
|
||||||
"import/no-namespace": "off",
|
"import/no-namespace": "off",
|
||||||
"import/no-unresolved": "error",
|
"import/no-unresolved": "error",
|
||||||
"import/no-webpack-loader-syntax": "error",
|
"import/no-webpack-loader-syntax": "error",
|
||||||
|
"import/order": ["error", {
|
||||||
|
"alphabetize": {"order": "asc"},
|
||||||
|
"newlines-between": "always"
|
||||||
|
}],
|
||||||
"no-async-foreach/no-async-foreach": "error",
|
"no-async-foreach/no-async-foreach": "error",
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"no-sequences": "error",
|
"no-sequences": "error",
|
||||||
"one-var": ["error", "never"],
|
"one-var": ["error", "never"]
|
||||||
"sort-imports": ["error", { "allowSeparatedGroups": true }]
|
|
||||||
},
|
},
|
||||||
"overrides": [{
|
"overrides": [{
|
||||||
// "temporarily downgraded during transition to eslint
|
// "temporarily downgraded during transition to eslint
|
||||||
@@ -44,16 +47,9 @@
|
|||||||
"@typescript-eslint/prefer-regexp-exec": "off",
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
||||||
"@typescript-eslint/require-await": "off",
|
"@typescript-eslint/require-await": "off",
|
||||||
"@typescript-eslint/restrict-template-expressions": "off",
|
"@typescript-eslint/restrict-template-expressions": "off",
|
||||||
"eslint-comments/no-use": "off",
|
|
||||||
"func-style": "off",
|
"func-style": "off",
|
||||||
"github/array-foreach": "off",
|
|
||||||
"github/no-then": "off",
|
"github/no-then": "off",
|
||||||
"import/no-extraneous-dependencies": "off",
|
"no-shadow": "off"
|
||||||
"no-shadow": "off",
|
|
||||||
"no-sparse-arrays": "off",
|
|
||||||
"no-throw-literal": "off",
|
|
||||||
"no-useless-escape": "off",
|
|
||||||
"sort-imports": "off"
|
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|||||||
5
.github/workflows/codeql.yml
vendored
5
.github/workflows/codeql.yml
vendored
@@ -1,6 +1,9 @@
|
|||||||
name: "CodeQL action"
|
name: "CodeQL action"
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, v1]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
21
.github/workflows/integration-testing.yml
vendored
21
.github/workflows/integration-testing.yml
vendored
@@ -1,6 +1,9 @@
|
|||||||
name: "Integration Testing"
|
name: "Integration Testing"
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, v1]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
multi-language-repo_test-autodetect-languages:
|
multi-language-repo_test-autodetect-languages:
|
||||||
@@ -41,6 +44,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
tools: [~, latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -53,6 +57,7 @@ jobs:
|
|||||||
mv ../action/tests/multi-language-repo/{*,.github} .
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
|
tools: ${{ matrix.tools }}
|
||||||
languages: cpp,csharp,java,javascript,python
|
languages: cpp,csharp,java,javascript,python
|
||||||
config-file: github/codeql-action/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ github.sha }}
|
config-file: github/codeql-action/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ github.sha }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
@@ -150,7 +155,7 @@ jobs:
|
|||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
runner-analyze-javascript-ubuntu:
|
runner-analyze-javascript-ubuntu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -176,7 +181,7 @@ jobs:
|
|||||||
runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
runner-analyze-javascript-windows:
|
runner-analyze-javascript-windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
@@ -198,7 +203,7 @@ jobs:
|
|||||||
runner/dist/codeql-runner-win.exe analyze --repository $Env:GITHUB_REPOSITORY --commit $Env:GITHUB_SHA --ref $Env:GITHUB_REF --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
runner/dist/codeql-runner-win.exe analyze --repository $Env:GITHUB_REPOSITORY --commit $Env:GITHUB_SHA --ref $Env:GITHUB_REF --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
runner-analyze-javascript-macos:
|
runner-analyze-javascript-macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
@@ -220,7 +225,7 @@ jobs:
|
|||||||
runner/dist/codeql-runner-macos analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
runner/dist/codeql-runner-macos analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
runner-analyze-csharp-ubuntu:
|
runner-analyze-csharp-ubuntu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -254,7 +259,7 @@ jobs:
|
|||||||
../action/runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
../action/runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
runner-analyze-csharp-windows:
|
runner-analyze-csharp-windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
@@ -325,7 +330,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
|
|
||||||
runner-analyze-csharp-autobuild-ubuntu:
|
runner-analyze-csharp-autobuild-ubuntu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -358,7 +363,7 @@ jobs:
|
|||||||
../action/runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
../action/runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
env:
|
env:
|
||||||
TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
|
||||||
runner-analyze-csharp-autobuild-windows:
|
runner-analyze-csharp-autobuild-windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
|||||||
7
.github/workflows/pr-checks.yml
vendored
7
.github/workflows/pr-checks.yml
vendored
@@ -1,6 +1,9 @@
|
|||||||
name: "PR checks"
|
name: "PR checks"
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, v1]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-js:
|
lint-js:
|
||||||
@@ -62,7 +65,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Success: node_modules are up to date"
|
echo "Success: node_modules are up to date"
|
||||||
|
|
||||||
npm-test:
|
npm-test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|||||||
63
.github/workflows/python-deps.yml
vendored
Normal file
63
.github/workflows/python-deps.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
name: Test Python Package Installation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, v1]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test-setup-python-scripts:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- test_dir: python-setup/tests/pipenv/requests-2
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
|
||||||
|
- test_dir: python-setup/tests/pipenv/requests-3
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
|
||||||
|
|
||||||
|
- test_dir: python-setup/tests/poetry/requests-2
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
|
||||||
|
- test_dir: python-setup/tests/poetry/requests-3
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
|
||||||
|
|
||||||
|
- test_dir: python-setup/tests/requirements/requests-2
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
|
||||||
|
- test_dir: python-setup/tests/requirements/requests-3
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
|
||||||
|
|
||||||
|
- test_dir: python-setup/tests/setup_py/requests-2
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
|
||||||
|
- test_dir: python-setup/tests/setup_py/requests-3
|
||||||
|
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
|
||||||
|
|
||||||
|
# This one shouldn't fail, but also won't install packages
|
||||||
|
- test_dir: python-setup/tests/requirements/non-standard-location
|
||||||
|
test_script: test -z $LGTM_INDEX_IMPORT_PATH
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: python
|
||||||
|
|
||||||
|
- name: Test Auto Package Installation
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
$GITHUB_WORKSPACE/python-setup/install_tools.sh
|
||||||
|
echo -e '\n\n\n\n\n' && sleep 0.5
|
||||||
|
cd $GITHUB_WORKSPACE/${{ matrix.test_dir }}
|
||||||
|
find /opt/hostedtoolcache/CodeQL -path "*x64/codeql" -exec $GITHUB_WORKSPACE/python-setup/auto_install_packages.py {} \;
|
||||||
|
- name: Setup for extractor
|
||||||
|
run: |
|
||||||
|
echo $CODEQL_PYTHON
|
||||||
|
# only run if $CODEQL_PYTHON is set
|
||||||
|
test ! -z $CODEQL_PYTHON && $GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON || /bin/true
|
||||||
|
- name: Verify packages installed
|
||||||
|
run: |
|
||||||
|
${{ matrix.test_script }}
|
||||||
73
.github/workflows/split.yml
vendored
Normal file
73
.github/workflows/split.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#
|
||||||
|
# Split the CodeQL Bundle into platform bundles
|
||||||
|
#
|
||||||
|
# Instructions:
|
||||||
|
# 1. Upload the new codeql-bundle (codeql-bundle.tar.gz) as an asset of the
|
||||||
|
# release (codeql-bundle-20200826)
|
||||||
|
# 2. Take note of the CLI Release used by the bundle (e.g., v2.2.5)
|
||||||
|
# 3. Manually launch this workflow file (via the Actions UI) specifying
|
||||||
|
# - The CLI Release (e.g., v2.2.5)
|
||||||
|
# - The release tag (e.g., codeql-bundle-20200826)
|
||||||
|
# 4. If everything succeeds you should see 3 new assets.
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Split Bundle
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
cli-release:
|
||||||
|
description: 'CodeQL CLI Release (e.g., "v2.2.5")'
|
||||||
|
required: true
|
||||||
|
bundle-tag:
|
||||||
|
description: 'Tag of the bundle release (e.g., "codeql-bundle-20200826")'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CLI_RELEASE: "${{ github.event.inputs.cli-release }}"
|
||||||
|
RELEASE_TAG: "${{ github.event.inputs.bundle-tag }}"
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ["linux64", "osx64", "win64"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Resolve Upload URL for the release
|
||||||
|
id: save_url
|
||||||
|
run: |
|
||||||
|
UPLOAD_URL=$(curl -sS \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq .upload_url | sed s/\"//g)
|
||||||
|
echo ${UPLOAD_URL}
|
||||||
|
echo "::set-output name=upload_url::${UPLOAD_URL}"
|
||||||
|
|
||||||
|
- name: Download CodeQL CLI and Bundle
|
||||||
|
run: |
|
||||||
|
wget --no-verbose "https://github.com/${GITHUB_REPOSITORY}/releases/download/${RELEASE_TAG}/codeql-bundle.tar.gz"
|
||||||
|
wget --no-verbose "https://github.com/github/codeql-cli-binaries/releases/download/${CLI_RELEASE}/codeql-${{matrix.platform}}.zip"
|
||||||
|
|
||||||
|
- name: Create Platform Package
|
||||||
|
# Replace the codeql-binaries with the platform specific ones
|
||||||
|
run: |
|
||||||
|
gunzip codeql-bundle.tar.gz
|
||||||
|
tar -f codeql-bundle.tar --delete codeql
|
||||||
|
unzip -q codeql-${{matrix.platform}}.zip
|
||||||
|
tar -f codeql-bundle.tar --append codeql
|
||||||
|
gzip codeql-bundle.tar
|
||||||
|
mv codeql-bundle.tar.gz codeql-bundle-${{matrix.platform}}.tar.gz
|
||||||
|
du -sh codeql-bundle-${{matrix.platform}}.tar.gz
|
||||||
|
|
||||||
|
- name: Upload Platform Package
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.save_url.outputs.upload_url }}
|
||||||
|
asset_path: ./codeql-bundle-${{matrix.platform}}.tar.gz
|
||||||
|
asset_name: codeql-bundle-${{matrix.platform}}.tar.gz
|
||||||
|
asset_content_type: application/tar+gzip
|
||||||
@@ -22,6 +22,15 @@ on:
|
|||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
schedule:
|
schedule:
|
||||||
|
# ┌───────────── minute (0 - 59)
|
||||||
|
# │ ┌───────────── hour (0 - 23)
|
||||||
|
# │ │ ┌───────────── day of the month (1 - 31)
|
||||||
|
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
||||||
|
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
||||||
|
# │ │ │ │ │
|
||||||
|
# │ │ │ │ │
|
||||||
|
# │ │ │ │ │
|
||||||
|
# * * * * *
|
||||||
- cron: '0 0 * * 0'
|
- cron: '0 0 * * 0'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ inputs:
|
|||||||
add-snippets:
|
add-snippets:
|
||||||
description: Specify whether or not to add code snippets to the output sarif file.
|
description: Specify whether or not to add code snippets to the output sarif file.
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "false"
|
||||||
threads:
|
threads:
|
||||||
description: The number of threads to be used by CodeQL.
|
description: The number of threads to be used by CodeQL.
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ inputs:
|
|||||||
queries:
|
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.
|
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
|
required: false
|
||||||
|
setup-python-dependencies:
|
||||||
|
description: Try to auto-install your python dependencies
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: '../lib/init-action.js'
|
main: '../lib/init-action.js'
|
||||||
|
|||||||
267
lib/actions-util.js
generated
Normal file
267
lib/actions-util.js
generated
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
"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 core = __importStar(require("@actions/core"));
|
||||||
|
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
|
const api = __importStar(require("./api-client"));
|
||||||
|
const sharedEnv = __importStar(require("./shared-environment"));
|
||||||
|
const util_1 = require("./util");
|
||||||
|
/**
|
||||||
|
* Wrapper around core.getInput for inputs that always have a value.
|
||||||
|
* Also see getOptionalInput.
|
||||||
|
*
|
||||||
|
* This allows us to get stronger type checking of required/optional inputs
|
||||||
|
* and make behaviour more consistent between actions and the runner.
|
||||||
|
*/
|
||||||
|
function getRequiredInput(name) {
|
||||||
|
return core.getInput(name, { required: true });
|
||||||
|
}
|
||||||
|
exports.getRequiredInput = getRequiredInput;
|
||||||
|
/**
|
||||||
|
* Wrapper around core.getInput that converts empty inputs to undefined.
|
||||||
|
* Also see getRequiredInput.
|
||||||
|
*
|
||||||
|
* This allows us to get stronger type checking of required/optional inputs
|
||||||
|
* and make behaviour more consistent between actions and the runner.
|
||||||
|
*/
|
||||||
|
function getOptionalInput(name) {
|
||||||
|
const value = core.getInput(name);
|
||||||
|
return value.length > 0 ? value : undefined;
|
||||||
|
}
|
||||||
|
exports.getOptionalInput = getOptionalInput;
|
||||||
|
/**
|
||||||
|
* Get an environment parameter, but throw an error if it is not set.
|
||||||
|
*/
|
||||||
|
function getRequiredEnvParam(paramName) {
|
||||||
|
const value = process.env[paramName];
|
||||||
|
if (value === undefined || value.length === 0) {
|
||||||
|
throw new Error(`${paramName} environment variable must be set`);
|
||||||
|
}
|
||||||
|
core.debug(`${paramName}=${value}`);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
exports.getRequiredEnvParam = getRequiredEnvParam;
|
||||||
|
/**
|
||||||
|
* Ensures all required environment variables are set in the context of a local run.
|
||||||
|
*/
|
||||||
|
function prepareLocalRunEnvironment() {
|
||||||
|
if (!util_1.isLocalRun()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
core.debug("Action is running locally.");
|
||||||
|
if (!process.env.GITHUB_JOB) {
|
||||||
|
core.exportVariable("GITHUB_JOB", "UNKNOWN-JOB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.prepareLocalRunEnvironment = prepareLocalRunEnvironment;
|
||||||
|
/**
|
||||||
|
* Gets the SHA of the commit that is currently checked out.
|
||||||
|
*/
|
||||||
|
exports.getCommitOid = async function () {
|
||||||
|
// Try to use git to get the current commit SHA. If that fails then
|
||||||
|
// log but otherwise silently fall back to using the SHA from the environment.
|
||||||
|
// The only time these two values will differ is during analysis of a PR when
|
||||||
|
// the workflow has changed the current commit to the head commit instead of
|
||||||
|
// the merge commit, which must mean that git is available.
|
||||||
|
// Even if this does go wrong, it's not a huge problem for the alerts to
|
||||||
|
// reported on the merge commit.
|
||||||
|
try {
|
||||||
|
let commitOid = "";
|
||||||
|
await new toolrunnner.ToolRunner("git", ["rev-parse", "HEAD"], {
|
||||||
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
commitOid += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data) => {
|
||||||
|
process.stderr.write(data);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).exec();
|
||||||
|
return commitOid.trim();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
core.info(`Failed to call git to get current commit. Continuing with data from environment: ${e}`);
|
||||||
|
return getRequiredEnvParam("GITHUB_SHA");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Get the path of the currently executing workflow.
|
||||||
|
*/
|
||||||
|
async function getWorkflowPath() {
|
||||||
|
const repo_nwo = getRequiredEnvParam("GITHUB_REPOSITORY").split("/");
|
||||||
|
const owner = repo_nwo[0];
|
||||||
|
const repo = repo_nwo[1];
|
||||||
|
const run_id = Number(getRequiredEnvParam("GITHUB_RUN_ID"));
|
||||||
|
const apiClient = api.getActionsApiClient();
|
||||||
|
const runsResponse = await apiClient.request("GET /repos/:owner/:repo/actions/runs/:run_id", {
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
run_id,
|
||||||
|
});
|
||||||
|
const workflowUrl = runsResponse.data.workflow_url;
|
||||||
|
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
|
||||||
|
return workflowResponse.data.path;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the workflow run ID.
|
||||||
|
*/
|
||||||
|
function getWorkflowRunID() {
|
||||||
|
const workflowRunID = parseInt(getRequiredEnvParam("GITHUB_RUN_ID"), 10);
|
||||||
|
if (Number.isNaN(workflowRunID)) {
|
||||||
|
throw new Error("GITHUB_RUN_ID must define a non NaN workflow run ID");
|
||||||
|
}
|
||||||
|
return workflowRunID;
|
||||||
|
}
|
||||||
|
exports.getWorkflowRunID = getWorkflowRunID;
|
||||||
|
/**
|
||||||
|
* Get the analysis key paramter for the current job.
|
||||||
|
*
|
||||||
|
* This will combine the workflow path and current job name.
|
||||||
|
* Computing this the first time requires making requests to
|
||||||
|
* the github API, but after that the result will be cached.
|
||||||
|
*/
|
||||||
|
async function getAnalysisKey() {
|
||||||
|
const analysisKeyEnvVar = "CODEQL_ACTION_ANALYSIS_KEY";
|
||||||
|
let analysisKey = process.env[analysisKeyEnvVar];
|
||||||
|
if (analysisKey !== undefined) {
|
||||||
|
return analysisKey;
|
||||||
|
}
|
||||||
|
const workflowPath = await getWorkflowPath();
|
||||||
|
const jobName = getRequiredEnvParam("GITHUB_JOB");
|
||||||
|
analysisKey = `${workflowPath}:${jobName}`;
|
||||||
|
core.exportVariable(analysisKeyEnvVar, analysisKey);
|
||||||
|
return analysisKey;
|
||||||
|
}
|
||||||
|
exports.getAnalysisKey = getAnalysisKey;
|
||||||
|
/**
|
||||||
|
* Get the ref currently being analyzed.
|
||||||
|
*/
|
||||||
|
async function getRef() {
|
||||||
|
// Will be in the form "refs/heads/master" on a push event
|
||||||
|
// or in the form "refs/pull/N/merge" on a pull_request event
|
||||||
|
const ref = getRequiredEnvParam("GITHUB_REF");
|
||||||
|
// For pull request refs we want to detect whether the workflow
|
||||||
|
// has run `git checkout HEAD^2` to analyze the 'head' ref rather
|
||||||
|
// than the 'merge' ref. If so, we want to convert the ref that
|
||||||
|
// we report back.
|
||||||
|
const pull_ref_regex = /refs\/pull\/(\d+)\/merge/;
|
||||||
|
const checkoutSha = await exports.getCommitOid();
|
||||||
|
if (pull_ref_regex.test(ref) &&
|
||||||
|
checkoutSha !== getRequiredEnvParam("GITHUB_SHA")) {
|
||||||
|
return ref.replace(pull_ref_regex, "refs/pull/$1/head");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getRef = getRef;
|
||||||
|
/**
|
||||||
|
* Compose a StatusReport.
|
||||||
|
*
|
||||||
|
* @param actionName The name of the action, e.g. 'init', 'finish', 'upload-sarif'
|
||||||
|
* @param status The status. Must be 'success', 'failure', or 'starting'
|
||||||
|
* @param startedAt The time this action started executing.
|
||||||
|
* @param cause Cause of failure (only supply if status is 'failure')
|
||||||
|
* @param exception Exception (only supply if status is 'failure')
|
||||||
|
*/
|
||||||
|
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
|
||||||
|
const commitOid = process.env["GITHUB_SHA"] || "";
|
||||||
|
const ref = await getRef();
|
||||||
|
const workflowRunIDStr = process.env["GITHUB_RUN_ID"];
|
||||||
|
let workflowRunID = -1;
|
||||||
|
if (workflowRunIDStr) {
|
||||||
|
workflowRunID = parseInt(workflowRunIDStr, 10);
|
||||||
|
}
|
||||||
|
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
|
||||||
|
const jobName = process.env["GITHUB_JOB"] || "";
|
||||||
|
const analysis_key = await getAnalysisKey();
|
||||||
|
let workflowStartedAt = process.env[sharedEnv.CODEQL_WORKFLOW_STARTED_AT];
|
||||||
|
if (workflowStartedAt === undefined) {
|
||||||
|
workflowStartedAt = actionStartedAt.toISOString();
|
||||||
|
core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt);
|
||||||
|
}
|
||||||
|
const statusReport = {
|
||||||
|
workflow_run_id: workflowRunID,
|
||||||
|
workflow_name: workflowName,
|
||||||
|
job_name: jobName,
|
||||||
|
analysis_key,
|
||||||
|
commit_oid: commitOid,
|
||||||
|
ref,
|
||||||
|
action_name: actionName,
|
||||||
|
action_oid: "unknown",
|
||||||
|
started_at: workflowStartedAt,
|
||||||
|
action_started_at: actionStartedAt.toISOString(),
|
||||||
|
status,
|
||||||
|
};
|
||||||
|
// Add optional parameters
|
||||||
|
if (cause) {
|
||||||
|
statusReport.cause = cause;
|
||||||
|
}
|
||||||
|
if (exception) {
|
||||||
|
statusReport.exception = exception;
|
||||||
|
}
|
||||||
|
if (status === "success" || status === "failure" || status === "aborted") {
|
||||||
|
statusReport.completed_at = new Date().toISOString();
|
||||||
|
}
|
||||||
|
const matrix = getRequiredInput("matrix");
|
||||||
|
if (matrix) {
|
||||||
|
statusReport.matrix_vars = matrix;
|
||||||
|
}
|
||||||
|
return statusReport;
|
||||||
|
}
|
||||||
|
exports.createStatusReportBase = createStatusReportBase;
|
||||||
|
/**
|
||||||
|
* Send a status report to the code_scanning/analysis/status endpoint.
|
||||||
|
*
|
||||||
|
* Optionally checks the response from the API endpoint and sets the action
|
||||||
|
* as failed if the status report failed. This is only expected to be used
|
||||||
|
* when sending a 'starting' report.
|
||||||
|
*
|
||||||
|
* Returns whether sending the status report was successful of not.
|
||||||
|
*/
|
||||||
|
async function sendStatusReport(statusReport, ignoreFailures) {
|
||||||
|
if (getRequiredEnvParam("GITHUB_SERVER_URL") !== util_1.GITHUB_DOTCOM_URL) {
|
||||||
|
core.debug("Not sending status report to GitHub Enterprise");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (util_1.isLocalRun()) {
|
||||||
|
core.debug("Not sending status report because this is a local run");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const statusReportJSON = JSON.stringify(statusReport);
|
||||||
|
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||||
|
const nwo = getRequiredEnvParam("GITHUB_REPOSITORY");
|
||||||
|
const [owner, repo] = nwo.split("/");
|
||||||
|
const client = api.getActionsApiClient();
|
||||||
|
const statusResponse = await client.request("PUT /repos/:owner/:repo/code-scanning/analysis/status", {
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
data: statusReportJSON,
|
||||||
|
});
|
||||||
|
if (!ignoreFailures) {
|
||||||
|
// If the status report request fails with a 403 or a 404, then this is a deliberate
|
||||||
|
// message from the endpoint that the SARIF upload can be expected to fail too,
|
||||||
|
// so the action should fail to avoid wasting actions minutes.
|
||||||
|
//
|
||||||
|
// Other failure responses (or lack thereof) could be transitory and should not
|
||||||
|
// cause the action to fail.
|
||||||
|
if (statusResponse.status === 403) {
|
||||||
|
core.setFailed("The repo on which this action is running is not opted-in to CodeQL code scanning.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (statusResponse.status === 404) {
|
||||||
|
core.setFailed("Not authorized to used the CodeQL code scanning feature on this repo.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
exports.sendStatusReport = sendStatusReport;
|
||||||
|
//# sourceMappingURL=actions-util.js.map
|
||||||
1
lib/actions-util.js.map
Normal file
1
lib/actions-util.js.map
Normal file
File diff suppressed because one or more lines are too long
55
lib/actions-util.test.js
generated
Normal file
55
lib/actions-util.test.js
generated
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"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 = {};
|
||||||
|
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 ava_1 = __importDefault(require("ava"));
|
||||||
|
const sinon_1 = __importDefault(require("sinon"));
|
||||||
|
const actionsutil = __importStar(require("./actions-util"));
|
||||||
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
testing_utils_1.setupTests(ava_1.default);
|
||||||
|
ava_1.default("getRef() throws on the empty string", async (t) => {
|
||||||
|
process.env["GITHUB_REF"] = "";
|
||||||
|
await t.throwsAsync(actionsutil.getRef);
|
||||||
|
});
|
||||||
|
ava_1.default("getRef() returns merge PR ref if GITHUB_SHA still checked out", async (t) => {
|
||||||
|
const expectedRef = "refs/pull/1/merge";
|
||||||
|
const currentSha = "a".repeat(40);
|
||||||
|
process.env["GITHUB_REF"] = expectedRef;
|
||||||
|
process.env["GITHUB_SHA"] = currentSha;
|
||||||
|
sinon_1.default.stub(actionsutil, "getCommitOid").resolves(currentSha);
|
||||||
|
const actualRef = await actionsutil.getRef();
|
||||||
|
t.deepEqual(actualRef, expectedRef);
|
||||||
|
});
|
||||||
|
ava_1.default("getRef() returns head PR ref if GITHUB_SHA not currently checked out", async (t) => {
|
||||||
|
process.env["GITHUB_REF"] = "refs/pull/1/merge";
|
||||||
|
process.env["GITHUB_SHA"] = "a".repeat(40);
|
||||||
|
sinon_1.default.stub(actionsutil, "getCommitOid").resolves("b".repeat(40));
|
||||||
|
const actualRef = await actionsutil.getRef();
|
||||||
|
t.deepEqual(actualRef, "refs/pull/1/head");
|
||||||
|
});
|
||||||
|
ava_1.default("prepareEnvironment() when a local run", (t) => {
|
||||||
|
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
|
||||||
|
process.env.CODEQL_LOCAL_RUN = "false";
|
||||||
|
process.env.GITHUB_JOB = "YYY";
|
||||||
|
actionsutil.prepareLocalRunEnvironment();
|
||||||
|
// unchanged
|
||||||
|
t.deepEqual(process.env.GITHUB_JOB, "YYY");
|
||||||
|
process.env.CODEQL_LOCAL_RUN = "true";
|
||||||
|
actionsutil.prepareLocalRunEnvironment();
|
||||||
|
// unchanged
|
||||||
|
t.deepEqual(process.env.GITHUB_JOB, "YYY");
|
||||||
|
process.env.GITHUB_JOB = "";
|
||||||
|
actionsutil.prepareLocalRunEnvironment();
|
||||||
|
// updated
|
||||||
|
t.deepEqual(process.env.GITHUB_JOB, "UNKNOWN-JOB");
|
||||||
|
process.env.CODEQL_LOCAL_RUN = origLocalRun;
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=actions-util.test.js.map
|
||||||
1
lib/actions-util.test.js.map
Normal file
1
lib/actions-util.test.js.map
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"actions-util.test.js","sourceRoot":"","sources":["../src/actions-util.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AACvB,kDAA0B;AAE1B,4DAA8C;AAC9C,mDAA6C;AAE7C,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,qCAAqC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACtD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;IAC/B,MAAM,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,+DAA+D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAChF,MAAM,WAAW,GAAG,mBAAmB,CAAC;IACxC,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;IAEvC,eAAK,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE7D,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,CAAC;IAC7C,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACtC,CAAC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AAE,aAAa,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,YAAY,CAAC;AAC9C,CAAC,CAAC,CAAC"}
|
||||||
24
lib/analysis-paths.js
generated
24
lib/analysis-paths.js
generated
@@ -1,10 +1,18 @@
|
|||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = __importStar(require("path"));
|
||||||
function isInterpretedLanguage(language) {
|
function isInterpretedLanguage(language) {
|
||||||
return language === "javascript" || language === "python";
|
return language === "javascript" || language === "python";
|
||||||
}
|
}
|
||||||
// Matches a string containing only characters that are legal to include in paths on windows.
|
// Matches a string containing only characters that are legal to include in paths on windows.
|
||||||
exports.legalWindowsPathCharactersRegex = /^[^<>:"\|?]*$/;
|
exports.legalWindowsPathCharactersRegex = /^[^<>:"|?]*$/;
|
||||||
// Builds an environment variable suitable for LGTM_INDEX_INCLUDE or LGTM_INDEX_EXCLUDE
|
// Builds an environment variable suitable for LGTM_INDEX_INCLUDE or LGTM_INDEX_EXCLUDE
|
||||||
function buildIncludeExcludeEnvVar(paths) {
|
function buildIncludeExcludeEnvVar(paths) {
|
||||||
// Ignore anything containing a *
|
// Ignore anything containing a *
|
||||||
@@ -35,8 +43,18 @@ function includeAndExcludeAnalysisPaths(config) {
|
|||||||
if (config.paths.length !== 0) {
|
if (config.paths.length !== 0) {
|
||||||
process.env["LGTM_INDEX_INCLUDE"] = buildIncludeExcludeEnvVar(config.paths);
|
process.env["LGTM_INDEX_INCLUDE"] = buildIncludeExcludeEnvVar(config.paths);
|
||||||
}
|
}
|
||||||
if (config.pathsIgnore.length !== 0) {
|
// If the temporary or tools directory is in the working directory ignore that too.
|
||||||
process.env["LGTM_INDEX_EXCLUDE"] = buildIncludeExcludeEnvVar(config.pathsIgnore);
|
const tempRelativeToWorking = path.relative(process.cwd(), config.tempDir);
|
||||||
|
const toolsRelativeToWorking = path.relative(process.cwd(), config.toolCacheDir);
|
||||||
|
let pathsIgnore = config.pathsIgnore;
|
||||||
|
if (!tempRelativeToWorking.startsWith("..")) {
|
||||||
|
pathsIgnore = pathsIgnore.concat(tempRelativeToWorking);
|
||||||
|
}
|
||||||
|
if (!toolsRelativeToWorking.startsWith("..")) {
|
||||||
|
pathsIgnore = pathsIgnore.concat(toolsRelativeToWorking);
|
||||||
|
}
|
||||||
|
if (pathsIgnore.length !== 0) {
|
||||||
|
process.env["LGTM_INDEX_EXCLUDE"] = buildIncludeExcludeEnvVar(pathsIgnore);
|
||||||
}
|
}
|
||||||
// The 'LGTM_INDEX_FILTERS' environment variable controls which files are
|
// The 'LGTM_INDEX_FILTERS' environment variable controls which files are
|
||||||
// extracted or ignored. It does not control which directories are traversed.
|
// extracted or ignored. It does not control which directories are traversed.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"analysis-paths.js","sourceRoot":"","sources":["../src/analysis-paths.ts"],"names":[],"mappings":";;AAGA,SAAS,qBAAqB,CAAC,QAAQ;IACrC,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,QAAQ,CAAC;AAC5D,CAAC;AAED,6FAA6F;AAChF,QAAA,+BAA+B,GAAG,eAAe,CAAC;AAE/D,uFAAuF;AACvF,SAAS,yBAAyB,CAAC,KAAe;IAChD,iCAAiC;IACjC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnD,uDAAuD;IACvD,IAAI,OAAO,CAAC,QAAQ,KA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,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,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"}
|
||||||
26
lib/analysis-paths.test.js
generated
26
lib/analysis-paths.test.js
generated
@@ -1,7 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@@ -9,7 +6,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = __importStar(require("path"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
@@ -51,4 +52,23 @@ ava_1.default("nonEmptyPaths", async (t) => {
|
|||||||
t.is(process.env["LGTM_INDEX_FILTERS"], "include:path1\ninclude:path2\ninclude:**/path3\nexclude:path4\nexclude:path5\nexclude:path6/**");
|
t.is(process.env["LGTM_INDEX_FILTERS"], "include:path1\ninclude:path2\ninclude:**/path3\nexclude:path4\nexclude:path5\nexclude:path6/**");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
ava_1.default("exclude temp dir", async (t) => {
|
||||||
|
return await util.withTmpDir(async (toolCacheDir) => {
|
||||||
|
const tempDir = path.join(process.cwd(), "codeql-runner-temp");
|
||||||
|
const config = {
|
||||||
|
languages: [],
|
||||||
|
queries: {},
|
||||||
|
pathsIgnore: [],
|
||||||
|
paths: [],
|
||||||
|
originalUserInput: {},
|
||||||
|
tempDir,
|
||||||
|
toolCacheDir,
|
||||||
|
codeQLCmd: "",
|
||||||
|
};
|
||||||
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||||
|
t.is(process.env["LGTM_INDEX_EXCLUDE"], "codeql-runner-temp");
|
||||||
|
t.is(process.env["LGTM_INDEX_FILTERS"], undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
//# sourceMappingURL=analysis-paths.test.js.map
|
//# sourceMappingURL=analysis-paths.test.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"analysis-paths.test.js","sourceRoot":"","sources":["../src/analysis-paths.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,gEAAkD;AAClD,mDAA6C;AAC7C,6CAA+B;AAE/B,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC7B,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,E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C,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAC9D,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
13
lib/analyze-action.js
generated
13
lib/analyze-action.js
generated
@@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const analyze_1 = require("./analyze");
|
const analyze_1 = require("./analyze");
|
||||||
const config_utils_1 = require("./config-utils");
|
const config_utils_1 = require("./config-utils");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
@@ -18,27 +19,27 @@ async function sendStatusReport(startedAt, stats, error) {
|
|||||||
const status = ((_a = stats) === null || _a === void 0 ? void 0 : _a.analyze_failure_language) !== undefined || error !== undefined
|
const status = ((_a = stats) === null || _a === void 0 ? void 0 : _a.analyze_failure_language) !== undefined || error !== undefined
|
||||||
? "failure"
|
? "failure"
|
||||||
: "success";
|
: "success";
|
||||||
const statusReportBase = await util.createStatusReportBase("finish", status, startedAt, (_b = error) === null || _b === void 0 ? void 0 : _b.message, (_c = error) === null || _c === void 0 ? void 0 : _c.stack);
|
const statusReportBase = await actionsUtil.createStatusReportBase("finish", status, startedAt, (_b = error) === null || _b === void 0 ? void 0 : _b.message, (_c = error) === null || _c === void 0 ? void 0 : _c.stack);
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
...(stats || {}),
|
...(stats || {}),
|
||||||
};
|
};
|
||||||
await util.sendStatusReport(statusReport);
|
await actionsUtil.sendStatusReport(statusReport);
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
let stats = undefined;
|
let stats = undefined;
|
||||||
try {
|
try {
|
||||||
util.prepareLocalRunEnvironment();
|
actionsUtil.prepareLocalRunEnvironment();
|
||||||
if (!(await util.sendStatusReport(await util.createStatusReportBase("finish", "starting", startedAt), true))) {
|
if (!(await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("finish", "starting", startedAt), true))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const logger = logging_1.getActionsLogger();
|
const logger = logging_1.getActionsLogger();
|
||||||
const config = await config_utils_1.getConfig(util.getRequiredEnvParam("RUNNER_TEMP"), logger);
|
const config = await config_utils_1.getConfig(actionsUtil.getRequiredEnvParam("RUNNER_TEMP"), logger);
|
||||||
if (config === undefined) {
|
if (config === undefined) {
|
||||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||||
}
|
}
|
||||||
stats = await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY")), await util.getCommitOid(), util.getRef(), await util.getAnalysisKey(), util.getRequiredEnvParam("GITHUB_WORKFLOW"), util.getWorkflowRunID(), core.getInput("checkout_path"), core.getInput("matrix"), core.getInput("token"), util.getRequiredEnvParam("GITHUB_SERVER_URL"), core.getInput("upload") === "true", "actions", core.getInput("output"), util.getMemoryFlag(core.getInput("ram")), util.getAddSnippetsFlag(core.getInput("add-snippets")), util.getThreadsFlag(core.getInput("threads"), logger), config, logger);
|
stats = await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")), await actionsUtil.getCommitOid(), await actionsUtil.getRef(), await actionsUtil.getAnalysisKey(), actionsUtil.getRequiredEnvParam("GITHUB_WORKFLOW"), actionsUtil.getWorkflowRunID(), actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getRequiredInput("matrix"), actionsUtil.getRequiredInput("token"), actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"), actionsUtil.getRequiredInput("upload") === "true", "actions", actionsUtil.getRequiredInput("output"), util.getMemoryFlag(actionsUtil.getOptionalInput("ram")), util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger), config, logger);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"analyze-action.js","sourceRoot":"","sources":["../src/analyze-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,uCAA6D;AAC7D,iDAA2C;AAC3C,uCAA6C;AAC7C,6CAAkD;AAClD,6CAA+B;AAM/B,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,IAAI,CAAC,sBAAsB,CACxD,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,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC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C,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EACvD,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,EACrE,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,EACpE,MAAM,EACN,MAAM,CACP,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO;KACR;IAED,MAAM,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IAChB,IAAI,CAAC,SAAS,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||||
80
lib/analyze.js
generated
80
lib/analyze.js
generated
@@ -9,12 +9,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const sharedEnv = __importStar(require("./shared-environment"));
|
const sharedEnv = __importStar(require("./shared-environment"));
|
||||||
const upload_lib = __importStar(require("./upload-lib"));
|
const upload_lib = __importStar(require("./upload-lib"));
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
|
async function setupPythonExtractor(logger) {
|
||||||
|
const codeqlPython = process.env["CODEQL_PYTHON"];
|
||||||
|
if (codeqlPython === undefined || codeqlPython.length === 0) {
|
||||||
|
// If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let output = "";
|
||||||
|
const options = {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
output += data.toString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await new toolrunnner.ToolRunner(codeqlPython, [
|
||||||
|
"-c",
|
||||||
|
"import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))",
|
||||||
|
], options).exec();
|
||||||
|
logger.info(`Setting LGTM_INDEX_IMPORT_PATH=${output}`);
|
||||||
|
process.env["LGTM_INDEX_IMPORT_PATH"] = output;
|
||||||
|
output = "";
|
||||||
|
await new toolrunnner.ToolRunner(codeqlPython, ["-c", "import sys; print(sys.version_info[0])"], options).exec();
|
||||||
|
logger.info(`Setting LGTM_PYTHON_SETUP_VERSION=${output}`);
|
||||||
|
process.env["LGTM_PYTHON_SETUP_VERSION"] = output;
|
||||||
|
}
|
||||||
async function createdDBForScannedLanguages(config, logger) {
|
async function createdDBForScannedLanguages(config, logger) {
|
||||||
// Insert the LGTM_INDEX_X env vars at this point so they are set when
|
// Insert the LGTM_INDEX_X env vars at this point so they are set when
|
||||||
// we extract any scanned languages.
|
// we extract any scanned languages.
|
||||||
@@ -23,6 +49,9 @@ async function createdDBForScannedLanguages(config, logger) {
|
|||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
if (languages_1.isScannedLanguage(language)) {
|
if (languages_1.isScannedLanguage(language)) {
|
||||||
logger.startGroup(`Extracting ${language}`);
|
logger.startGroup(`Extracting ${language}`);
|
||||||
|
if (language === languages_1.Language.python) {
|
||||||
|
await setupPythonExtractor(logger);
|
||||||
|
}
|
||||||
await codeql.extractScannedLanguage(util.getCodeQLDatabasePath(config.tempDir, language), language);
|
await codeql.extractScannedLanguage(util.getCodeQLDatabasePath(config.tempDir, language), language);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
@@ -39,35 +68,48 @@ async function finalizeDatabaseCreation(config, logger) {
|
|||||||
}
|
}
|
||||||
// Runs queries and creates sarif files in the given folder
|
// Runs queries and creates sarif files in the given folder
|
||||||
async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag, config, logger) {
|
async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag, config, logger) {
|
||||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
const statusReport = {};
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
logger.startGroup(`Analyzing ${language}`);
|
logger.startGroup(`Analyzing ${language}`);
|
||||||
const queries = config.queries[language] || [];
|
const queries = config.queries[language];
|
||||||
if (queries.length === 0) {
|
if (queries.builtin.length === 0 && queries.custom.length === 0) {
|
||||||
throw new Error(`Unable to analyse ${language} as no queries were selected for this language`);
|
throw new Error(`Unable to analyse ${language} as no queries were selected for this language`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config.tempDir, language);
|
for (const type of ["builtin", "custom"]) {
|
||||||
// Pass the queries to codeql using a file instead of using the command
|
if (queries[type].length > 0) {
|
||||||
// line to avoid command line length restrictions, particularly on windows.
|
const startTime = new Date().getTime();
|
||||||
const querySuite = `${databasePath}-queries.qls`;
|
const databasePath = util.getCodeQLDatabasePath(config.tempDir, language);
|
||||||
const querySuiteContents = queries.map((q) => `- query: ${q}`).join("\n");
|
// Pass the queries to codeql using a file instead of using the command
|
||||||
fs.writeFileSync(querySuite, querySuiteContents);
|
// line to avoid command line length restrictions, particularly on windows.
|
||||||
logger.debug(`Query suite file for ${language}...\n${querySuiteContents}`);
|
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
||||||
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
|
const querySuiteContents = queries[type]
|
||||||
await codeql.databaseAnalyze(databasePath, sarifFile, querySuite, memoryFlag, addSnippetsFlag, threadsFlag);
|
.map((q) => `- query: ${q}`)
|
||||||
logger.debug(`SARIF results for database ${language} created at "${sarifFile}"`);
|
.join("\n");
|
||||||
logger.endGroup();
|
fs.writeFileSync(querySuitePath, querySuiteContents);
|
||||||
|
logger.debug(`Query suite file for ${language}...\n${querySuiteContents}`);
|
||||||
|
const sarifFile = path.join(sarifFolder, `${language}-${type}.sarif`);
|
||||||
|
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||||
|
await codeql.databaseAnalyze(databasePath, sarifFile, querySuitePath, memoryFlag, addSnippetsFlag, threadsFlag);
|
||||||
|
logger.debug(`SARIF results for database ${language} created at "${sarifFile}"`);
|
||||||
|
logger.endGroup();
|
||||||
|
// Record the performance
|
||||||
|
const endTime = new Date().getTime();
|
||||||
|
statusReport[`analyze_${type}_queries_${language}_duration_ms`] =
|
||||||
|
endTime - startTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// For now the fields about query performance are not populated
|
logger.error(`Error running analysis for ${language}: ${e}`);
|
||||||
return {
|
logger.info(e);
|
||||||
analyze_failure_language: language,
|
statusReport.analyze_failure_language = language;
|
||||||
};
|
return statusReport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return statusReport;
|
||||||
}
|
}
|
||||||
|
exports.runQueries = runQueries;
|
||||||
async function runAnalyze(repositoryNwo, commitOid, ref, analysisKey, analysisName, workflowRunID, checkoutPath, environment, githubAuth, githubUrl, doUpload, mode, outputDir, memoryFlag, addSnippetsFlag, threadsFlag, config, logger) {
|
async function runAnalyze(repositoryNwo, commitOid, ref, analysisKey, analysisName, workflowRunID, checkoutPath, environment, githubAuth, githubUrl, doUpload, mode, outputDir, memoryFlag, addSnippetsFlag, threadsFlag, config, logger) {
|
||||||
// Delete the tracer config env var to avoid tracing ourselves
|
// Delete the tracer config env var to avoid tracing ourselves
|
||||||
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../src/analyze.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,gEAAkD;AAClD,qCAAqC;AAErC,2CAAgD;AAGhD,gEAAkD;AAClD,yDAA2C;AAC3C,6CAA+B;AAmC/B,KAAK,UAAU,4BAA4B,CACzC,MAA0B,EAC1B,MAAc;IAEd,sEAAsE;IACtE,oCAAoC;IACpC,aAAa,CAAC,8BAA8B,CAAC,MAAM,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,kBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI,6BAAiB,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAM,CAAC,UAAU,CAAC,cAAc,QAAQ,EAAE,CAAC,CAAC;YAC5C,MAAM,MAAM,CAAC,sBAAsB,CACjC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,EACpD,QAAQ,CACT,CAAC;YACF,MAAM,CAAC,QAAQ,EAAE,CAAC;SACnB;KACF;AACH,CAAC;AAED,KAAK,UAAU,wBAAwB,CACrC,MAA0B,EAC1B,MAAc;IAEd,MAAM,4BAA4B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,kBAAS,CAAC,MAAM,CAAC,SAAS,CAA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iB,EACjB,QAAiB,EACjB,IAAe,EACf,SAAiB,EACjB,UAAkB,EAClB,eAAuB,EACvB,WAAmB,EACnB,MAA0B,EAC1B,MAAc;IAEd,8DAA8D;IAC9D,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;IAEzD,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7C,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC5C,MAAM,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/C,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,UAAU,CACnC,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,MAAM,EACN,MAAM,CACP,CAAC;IAEF,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACrC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;KAC5B;IAED,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,MAAM,CACzC,SAAS,EACT,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,EACT,IAAI,EACJ,MAAM,CACP,CAAC;IAEF,OAAO,EAAE,GAAG,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;AAC7C,CAAC;AA5DD,gCA4DC"}
|
||||||
63
lib/analyze.test.js
generated
Normal file
63
lib/analyze.test.js
generated
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
"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 ava_1 = __importDefault(require("ava"));
|
||||||
|
const analyze_1 = require("./analyze");
|
||||||
|
const codeql_1 = require("./codeql");
|
||||||
|
const languages_1 = require("./languages");
|
||||||
|
const logging_1 = require("./logging");
|
||||||
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
const util = __importStar(require("./util"));
|
||||||
|
testing_utils_1.setupTests(ava_1.default);
|
||||||
|
// Checks that the duration fields are populated for the correct language
|
||||||
|
// and correct case of builtin or custom.
|
||||||
|
ava_1.default("status report fields", async (t) => {
|
||||||
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
|
codeql_1.setCodeQL({
|
||||||
|
databaseAnalyze: async () => undefined,
|
||||||
|
});
|
||||||
|
const memoryFlag = "";
|
||||||
|
const addSnippetsFlag = "";
|
||||||
|
const threadsFlag = "";
|
||||||
|
for (const language of Object.values(languages_1.Language)) {
|
||||||
|
const config = {
|
||||||
|
languages: [language],
|
||||||
|
queries: {},
|
||||||
|
pathsIgnore: [],
|
||||||
|
paths: [],
|
||||||
|
originalUserInput: {},
|
||||||
|
tempDir: tmpDir,
|
||||||
|
toolCacheDir: tmpDir,
|
||||||
|
codeQLCmd: "",
|
||||||
|
};
|
||||||
|
fs.mkdirSync(util.getCodeQLDatabasePath(config.tempDir, language), {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
config.queries[language] = {
|
||||||
|
builtin: ["foo.ql"],
|
||||||
|
custom: [],
|
||||||
|
};
|
||||||
|
const builtinStatusReport = await analyze_1.runQueries(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, config, logging_1.getRunnerLogger(true));
|
||||||
|
t.deepEqual(Object.keys(builtinStatusReport).length, 1);
|
||||||
|
t.true(`analyze_builtin_queries_${language}_duration_ms` in builtinStatusReport);
|
||||||
|
config.queries[language] = {
|
||||||
|
builtin: [],
|
||||||
|
custom: ["foo.ql"],
|
||||||
|
};
|
||||||
|
const customStatusReport = await analyze_1.runQueries(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, config, logging_1.getRunnerLogger(true));
|
||||||
|
t.deepEqual(Object.keys(customStatusReport).length, 1);
|
||||||
|
t.true(`analyze_custom_queries_${language}_duration_ms` in customStatusReport);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=analyze.test.js.map
|
||||||
1
lib/analyze.test.js.map
Normal file
1
lib/analyze.test.js.map
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"analyze.test.js","sourceRoot":"","sources":["../src/analyze.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAyB;AAEzB,8CAAuB;AAEvB,uCAAuC;AACvC,qCAAqC;AAErC,2CAAuC;AACvC,uCAA4C;AAC5C,mDAA6C;AAC7C,6CAA+B;AAE/B,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,yEAAyE;AACzE,yCAAyC;AACzC,aAAI,CAAC,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5C,kBAAS,CAAC;YACR,eAAe,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS;SACvC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,MAAM,eAAe,GAAG,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,oBAAQ,CAAC,EAAE;YAC9C,MAAM,MAAM,GAAW;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,OAA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,CAAC,CAAC,CAAC"}
|
||||||
15
lib/api-client.js
generated
15
lib/api-client.js
generated
@@ -10,21 +10,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const github = __importStar(require("@actions/github"));
|
|
||||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
||||||
|
const retry = __importStar(require("@octokit/plugin-retry"));
|
||||||
|
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||||
|
const actions_util_1 = require("./actions-util");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
exports.getApiClient = function (githubAuth, githubUrl, allowLocalRun = false) {
|
exports.getApiClient = function (githubAuth, githubUrl, allowLocalRun = false) {
|
||||||
if (util_1.isLocalRun() && !allowLocalRun) {
|
if (util_1.isLocalRun() && !allowLocalRun) {
|
||||||
throw new Error("Invalid API call in local run");
|
throw new Error("Invalid API call in local run");
|
||||||
}
|
}
|
||||||
return new github.GitHub({
|
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||||
auth: githubAuth,
|
return new retryingOctokit(githubUtils.getOctokitOptions(githubAuth, {
|
||||||
baseUrl: getApiUrl(githubUrl),
|
baseUrl: getApiUrl(githubUrl),
|
||||||
userAgent: "CodeQL Action",
|
userAgent: "CodeQL Action",
|
||||||
log: console_log_level_1.default({ level: "debug" }),
|
log: console_log_level_1.default({ level: "debug" }),
|
||||||
});
|
}));
|
||||||
};
|
};
|
||||||
function getApiUrl(githubUrl) {
|
function getApiUrl(githubUrl) {
|
||||||
const url = new URL(githubUrl);
|
const url = new URL(githubUrl);
|
||||||
@@ -41,7 +42,7 @@ function getApiUrl(githubUrl) {
|
|||||||
// Once all code has been coverted this function should be removed or made canonical
|
// Once all code has been coverted this function should be removed or made canonical
|
||||||
// and called only from the action entrypoints.
|
// and called only from the action entrypoints.
|
||||||
function getActionsApiClient(allowLocalRun = false) {
|
function getActionsApiClient(allowLocalRun = false) {
|
||||||
return exports.getApiClient(core.getInput("token"), util_1.getRequiredEnvParam("GITHUB_SERVER_URL"), allowLocalRun);
|
return exports.getApiClient(actions_util_1.getRequiredInput("token"), actions_util_1.getRequiredEnvParam("GITHUB_SERVER_URL"), allowLocalRun);
|
||||||
}
|
}
|
||||||
exports.getActionsApiClient = getActionsApiClient;
|
exports.getActionsApiClient = getActionsApiClient;
|
||||||
//# sourceMappingURL=api-client.js.map
|
//# sourceMappingURL=api-client.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsC;AACtC,wDAA0C;AAC1C,0EAAgD;AAChD,2CAA6B;AAE7B,iCAAyD;AAE5C,QAAA,YAAY,GAAG,UAC1B,UAAkB,EAClB,SAAiB,EACjB,aAAa,GAAG,KAAK;IAErB,IAAI,iBAAU,EAAE,IAAI,CAAC,aAAa,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC;QAC7B,SAAS,EAAE,eAAe;QAC1B,GAAG,EAAE,2BAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;KACzC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAS,SAAS,CAAC,SAAiB;IAClC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAE/B,kDAAkD;IA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AAC;AAEF,SAAS,SAAS,CAAC,SAAiB;IAClC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAE/B,kDAAkD;IAClD,0CAA0C;IAC1C,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,GAAG,CAAC,QAAQ,KAAK,gBAAgB,EAAE;QACtE,OAAO,wBAAwB,CAAC;KACjC;IAED,6BAA6B;IAC7B,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACpD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC;AAED,uFAAuF;AACvF,oFAAoF;AACpF,+CAA+C;AAC/C,SAAgB,mBAAmB,CAAC,aAAa,GAAG,KAAK;IACvD,OAAO,oBAAY,CACjB,+BAAgB,CAAC,OAAO,CAAC,EACzB,kCAAmB,CAAC,mBAAmB,CAAC,EACxC,aAAa,CACd,CAAC;AACJ,CAAC;AAND,kDAMC"}
|
||||||
12
lib/autobuild-action.js
generated
12
lib/autobuild-action.js
generated
@@ -8,33 +8,33 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const autobuild_1 = require("./autobuild");
|
const autobuild_1 = require("./autobuild");
|
||||||
const config_utils = __importStar(require("./config-utils"));
|
const config_utils = __importStar(require("./config-utils"));
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const util = __importStar(require("./util"));
|
|
||||||
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
const status = failingLanguage !== undefined || cause !== undefined
|
const status = failingLanguage !== undefined || cause !== undefined
|
||||||
? "failure"
|
? "failure"
|
||||||
: "success";
|
: "success";
|
||||||
const statusReportBase = await util.createStatusReportBase("autobuild", status, startedAt, (_a = cause) === null || _a === void 0 ? void 0 : _a.message, (_b = cause) === null || _b === void 0 ? void 0 : _b.stack);
|
const statusReportBase = await actionsUtil.createStatusReportBase("autobuild", status, startedAt, (_a = cause) === null || _a === void 0 ? void 0 : _a.message, (_b = cause) === null || _b === void 0 ? void 0 : _b.stack);
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
autobuild_languages: allLanguages.join(","),
|
autobuild_languages: allLanguages.join(","),
|
||||||
autobuild_failure: failingLanguage,
|
autobuild_failure: failingLanguage,
|
||||||
};
|
};
|
||||||
await util.sendStatusReport(statusReport);
|
await actionsUtil.sendStatusReport(statusReport);
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const logger = logging_1.getActionsLogger();
|
const logger = logging_1.getActionsLogger();
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
let language = undefined;
|
let language = undefined;
|
||||||
try {
|
try {
|
||||||
util.prepareLocalRunEnvironment();
|
actionsUtil.prepareLocalRunEnvironment();
|
||||||
if (!(await util.sendStatusReport(await util.createStatusReportBase("autobuild", "starting", startedAt), true))) {
|
if (!(await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("autobuild", "starting", startedAt), true))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const config = await config_utils.getConfig(util.getRequiredEnvParam("RUNNER_TEMP"), logger);
|
const config = await config_utils.getConfig(actionsUtil.getRequiredEnvParam("RUNNER_TEMP"), logger);
|
||||||
if (config === undefined) {
|
if (config === undefined) {
|
||||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,2CAAuE;AACvE,6DAA+C;AAE/C,uCAA6C;AAC7C,6CAA+B;AAS/B,KAAK,UAAU,yBAAyB,CACtC,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;;IAEb,MAAM,MAAM,GACV,eAAe,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;QAClD,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CACxD,WAAW,EACX,MAAM,EACN,SAAS,QACT,KAAK,0CAAE,OAAO,QACd,KAAK,0CAAE,KAAK,CACb,CAAC;IACF,MAAM,YAAY,GAA0B;QAC1C,GAAG,gBAAgB;QACnB,mBAAmB,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,iBAAiB,EAAE,eAAe;KACnC,CAAC;IACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,MAAM,GAAG,0BAAgB,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,QAAQ,GAAyB,SAAS,CAAC;IAC/C,IAAI;QACF,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IACE,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAC3B,MAAM,IAAI,CAAC,sBAAsB,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,EACrE,IAAI,CACL,CAAC,EACF;YACA,OAAO;SACR;QAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,CACzC,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,EACvC,MAAM,CACP,CAAC;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;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,yBAAyB,CAC7B,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAC1B,QAAQ,EACR,KAAK,CACN,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IAChB,IAAI,CAAC,SAAS,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||||
62
lib/codeql.js
generated
62
lib/codeql.js
generated
@@ -6,19 +6,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
const http = __importStar(require("@actions/http-client"));
|
const http = __importStar(require("@actions/http-client"));
|
||||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
const stream = __importStar(require("stream"));
|
const uuid_1 = require("uuid");
|
||||||
const globalutil = __importStar(require("util"));
|
const actions_util_1 = require("./actions-util");
|
||||||
const v4_1 = __importDefault(require("uuid/v4"));
|
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const defaults = __importStar(require("./defaults.json")); // Referenced from codeql-action-sync-tool!
|
const defaults = __importStar(require("./defaults.json")); // Referenced from codeql-action-sync-tool!
|
||||||
const error_matcher_1 = require("./error-matcher");
|
const error_matcher_1 = require("./error-matcher");
|
||||||
@@ -30,8 +28,23 @@ const util = __importStar(require("./util"));
|
|||||||
*/
|
*/
|
||||||
let cachedCodeQL = undefined;
|
let cachedCodeQL = undefined;
|
||||||
const CODEQL_BUNDLE_VERSION = defaults.bundleVersion;
|
const CODEQL_BUNDLE_VERSION = defaults.bundleVersion;
|
||||||
const CODEQL_BUNDLE_NAME = "codeql-bundle.tar.gz";
|
|
||||||
const CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
const CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
||||||
|
function getCodeQLBundleName() {
|
||||||
|
let platform;
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
platform = "win64";
|
||||||
|
}
|
||||||
|
else if (process.platform === "linux") {
|
||||||
|
platform = "linux64";
|
||||||
|
}
|
||||||
|
else if (process.platform === "darwin") {
|
||||||
|
platform = "osx64";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "codeql-bundle.tar.gz";
|
||||||
|
}
|
||||||
|
return `codeql-bundle-${platform}.tar.gz`;
|
||||||
|
}
|
||||||
function getCodeQLActionRepository(mode) {
|
function getCodeQLActionRepository(mode) {
|
||||||
if (mode !== "actions") {
|
if (mode !== "actions") {
|
||||||
return CODEQL_DEFAULT_ACTION_REPOSITORY;
|
return CODEQL_DEFAULT_ACTION_REPOSITORY;
|
||||||
@@ -39,7 +52,7 @@ function getCodeQLActionRepository(mode) {
|
|||||||
// Actions do not know their own repository name,
|
// Actions do not know their own repository name,
|
||||||
// so we currently use this hack to find the name based on where our files are.
|
// so we currently use this hack to find the name based on where our files are.
|
||||||
// This can be removed once the change to the runner in https://github.com/actions/runner/pull/585 is deployed.
|
// This can be removed once the change to the runner in https://github.com/actions/runner/pull/585 is deployed.
|
||||||
const runnerTemp = util.getRequiredEnvParam("RUNNER_TEMP");
|
const runnerTemp = actions_util_1.getRequiredEnvParam("RUNNER_TEMP");
|
||||||
const actionsDirectory = path.join(path.dirname(runnerTemp), "_actions");
|
const actionsDirectory = path.join(path.dirname(runnerTemp), "_actions");
|
||||||
const relativeScriptPath = path.relative(actionsDirectory, __filename);
|
const relativeScriptPath = path.relative(actionsDirectory, __filename);
|
||||||
// This handles the case where the Action does not come from an Action repository,
|
// This handles the case where the Action does not come from an Action repository,
|
||||||
@@ -64,6 +77,7 @@ async function getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger) {
|
|||||||
// We now filter out any duplicates.
|
// We now filter out any duplicates.
|
||||||
// Duplicates will happen either because the GitHub instance is GitHub.com, or because the Action is not a fork.
|
// Duplicates will happen either because the GitHub instance is GitHub.com, or because the Action is not a fork.
|
||||||
const uniqueDownloadSources = potentialDownloadSources.filter((url, index, self) => index === self.indexOf(url));
|
const uniqueDownloadSources = potentialDownloadSources.filter((url, index, self) => index === self.indexOf(url));
|
||||||
|
const codeQLBundleName = getCodeQLBundleName();
|
||||||
for (const downloadSource of uniqueDownloadSources) {
|
for (const downloadSource of uniqueDownloadSources) {
|
||||||
const [apiURL, repository] = downloadSource;
|
const [apiURL, repository] = downloadSource;
|
||||||
// If we've reached the final case, short-circuit the API check since we know the bundle exists and is public.
|
// If we've reached the final case, short-circuit the API check since we know the bundle exists and is public.
|
||||||
@@ -81,7 +95,7 @@ async function getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger) {
|
|||||||
tag: CODEQL_BUNDLE_VERSION,
|
tag: CODEQL_BUNDLE_VERSION,
|
||||||
});
|
});
|
||||||
for (const asset of release.data.assets) {
|
for (const asset of release.data.assets) {
|
||||||
if (asset.name === CODEQL_BUNDLE_NAME) {
|
if (asset.name === codeQLBundleName) {
|
||||||
logger.info(`Found CodeQL bundle in ${downloadSource[1]} on ${downloadSource[0]} with URL ${asset.url}.`);
|
logger.info(`Found CodeQL bundle in ${downloadSource[1]} on ${downloadSource[0]} with URL ${asset.url}.`);
|
||||||
return asset.url;
|
return asset.url;
|
||||||
}
|
}
|
||||||
@@ -91,13 +105,13 @@ async function getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger) {
|
|||||||
logger.info(`Looked for CodeQL bundle in ${downloadSource[1]} on ${downloadSource[0]} but got error ${e}.`);
|
logger.info(`Looked for CodeQL bundle in ${downloadSource[1]} on ${downloadSource[0]} but got error ${e}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return `https://github.com/${CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${CODEQL_BUNDLE_VERSION}/${CODEQL_BUNDLE_NAME}`;
|
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.
|
// 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.
|
// This can be removed once https://github.com/actions/toolkit/pull/530 is merged and released.
|
||||||
async function toolcacheDownloadTool(url, headers, tempDir, logger) {
|
async function toolcacheDownloadTool(url, headers, tempDir, logger) {
|
||||||
const client = new http.HttpClient("CodeQL Action");
|
const client = new http.HttpClient("CodeQL Action");
|
||||||
const dest = path.join(tempDir, v4_1.default());
|
const dest = path.join(tempDir, uuid_1.v4());
|
||||||
const response = await client.get(url, headers);
|
const response = await client.get(url, headers);
|
||||||
if (response.message.statusCode !== 200) {
|
if (response.message.statusCode !== 200) {
|
||||||
logger.info(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
logger.info(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||||
@@ -115,8 +129,28 @@ async function setupCodeQL(codeqlURL, githubAuth, githubUrl, tempDir, toolsDir,
|
|||||||
process.env["RUNNER_TEMP"] = tempDir;
|
process.env["RUNNER_TEMP"] = tempDir;
|
||||||
process.env["RUNNER_TOOL_CACHE"] = toolsDir;
|
process.env["RUNNER_TOOL_CACHE"] = toolsDir;
|
||||||
try {
|
try {
|
||||||
|
// We use the special value of 'latest' to prioritize the version in the
|
||||||
|
// defaults over any pinned cached version.
|
||||||
|
const forceLatest = codeqlURL === "latest";
|
||||||
|
if (forceLatest) {
|
||||||
|
codeqlURL = undefined;
|
||||||
|
}
|
||||||
const codeqlURLVersion = getCodeQLURLVersion(codeqlURL || `/${CODEQL_BUNDLE_VERSION}/`, logger);
|
const codeqlURLVersion = getCodeQLURLVersion(codeqlURL || `/${CODEQL_BUNDLE_VERSION}/`, logger);
|
||||||
|
// If we find the specified version, we always use that.
|
||||||
let codeqlFolder = toolcache.find("CodeQL", codeqlURLVersion);
|
let codeqlFolder = toolcache.find("CodeQL", codeqlURLVersion);
|
||||||
|
// 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");
|
||||||
|
if (codeqlVersions.length === 1) {
|
||||||
|
const tmpCodeqlFolder = toolcache.find("CodeQL", codeqlVersions[0]);
|
||||||
|
if (fs.existsSync(path.join(tmpCodeqlFolder, "pinned-version"))) {
|
||||||
|
logger.debug(`CodeQL in cache overriding the default ${CODEQL_BUNDLE_VERSION}`);
|
||||||
|
codeqlFolder = tmpCodeqlFolder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (codeqlFolder) {
|
if (codeqlFolder) {
|
||||||
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||||
}
|
}
|
||||||
@@ -386,6 +420,8 @@ function getExtraOptionsFromEnv(path) {
|
|||||||
*
|
*
|
||||||
* - the special terminal step name '*' in `options` matches all path steps
|
* - the special terminal step name '*' in `options` matches all path steps
|
||||||
* - throws an exception if this conversion is impossible.
|
* - throws an exception if this conversion is impossible.
|
||||||
|
*
|
||||||
|
* Exported for testing.
|
||||||
*/
|
*/
|
||||||
function getExtraOptions(options, path, pathInfo) {
|
function getExtraOptions(options, path, pathInfo) {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
69
lib/codeql.test.js
generated
69
lib/codeql.test.js
generated
@@ -10,11 +10,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = __importStar(require("path"));
|
||||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const nock_1 = __importDefault(require("nock"));
|
const nock_1 = __importDefault(require("nock"));
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const codeql = __importStar(require("./codeql"));
|
const codeql = __importStar(require("./codeql"));
|
||||||
|
const defaults = __importStar(require("./defaults.json"));
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
@@ -34,6 +35,72 @@ ava_1.default("download codeql bundle cache", async (t) => {
|
|||||||
t.is(cachedVersions.length, 2);
|
t.is(cachedVersions.length, 2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
ava_1.default("download codeql bundle cache explicitly requested with pinned different version cached", async (t) => {
|
||||||
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
|
nock_1.default("https://example.com")
|
||||||
|
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||||
|
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||||
|
nock_1.default("https://example.com")
|
||||||
|
.get(`/download/codeql-bundle-20200610/codeql-bundle.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||||
|
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200610/codeql-bundle.tar.gz", "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ava_1.default("don't download codeql bundle cache with pinned different version cached", async (t) => {
|
||||||
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
|
nock_1.default("https://example.com")
|
||||||
|
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||||
|
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||||
|
await codeql.setupCodeQL(undefined, "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
|
t.is(cachedVersions.length, 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ava_1.default("download codeql bundle cache with different version cached (not pinned)", async (t) => {
|
||||||
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
|
nock_1.default("https://example.com")
|
||||||
|
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||||
|
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||||
|
const platform = process.platform === "win32"
|
||||||
|
? "win64"
|
||||||
|
: process.platform === "linux"
|
||||||
|
? "linux64"
|
||||||
|
: "osx64";
|
||||||
|
nock_1.default("https://github.com")
|
||||||
|
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||||
|
await codeql.setupCodeQL(undefined, "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
|
t.is(cachedVersions.length, 2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ava_1.default('download codeql bundle cache with pinned different version cached if "latests" tools specified', async (t) => {
|
||||||
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
|
nock_1.default("https://example.com")
|
||||||
|
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||||
|
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||||
|
const platform = process.platform === "win32"
|
||||||
|
? "win64"
|
||||||
|
: process.platform === "linux"
|
||||||
|
? "linux64"
|
||||||
|
: "osx64";
|
||||||
|
nock_1.default("https://github.com")
|
||||||
|
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`)
|
||||||
|
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||||
|
await codeql.setupCodeQL("latest", "token", "https://github.com", tmpDir, tmpDir, "runner", logging_1.getRunnerLogger(true));
|
||||||
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
|
t.is(cachedVersions.length, 2);
|
||||||
|
});
|
||||||
|
});
|
||||||
ava_1.default("parse codeql bundle url version", (t) => {
|
ava_1.default("parse codeql bundle url version", (t) => {
|
||||||
const tests = {
|
const tests = {
|
||||||
"20200601": "0.0.0-20200601",
|
"20200601": "0.0.0-20200601",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
56
lib/config-utils.js
generated
56
lib/config-utils.js
generated
@@ -8,8 +8,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const yaml = __importStar(require("js-yaml"));
|
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const yaml = __importStar(require("js-yaml"));
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const externalQueries = __importStar(require("./external-queries"));
|
const externalQueries = __importStar(require("./external-queries"));
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
@@ -58,25 +58,39 @@ function validateQueries(resolvedQueries) {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Run 'codeql resolve queries' and add the results to resultMap
|
* Run 'codeql resolve queries' and add the results to resultMap
|
||||||
|
*
|
||||||
|
* If a checkout path is given then the queries are assumed to be custom queries
|
||||||
|
* and an error will be thrown if there is anything invalid about the queries.
|
||||||
|
* If a checkout path is not given then the queries are assumed to be builtin
|
||||||
|
* queries, and error checking will be suppressed.
|
||||||
*/
|
*/
|
||||||
async function runResolveQueries(codeQL, resultMap, toResolve, extraSearchPath, errorOnInvalidQueries) {
|
async function runResolveQueries(codeQL, resultMap, toResolve, extraSearchPath) {
|
||||||
const resolvedQueries = await codeQL.resolveQueries(toResolve, extraSearchPath);
|
const resolvedQueries = await codeQL.resolveQueries(toResolve, extraSearchPath);
|
||||||
for (const [language, queries] of Object.entries(resolvedQueries.byLanguage)) {
|
if (extraSearchPath !== undefined) {
|
||||||
if (resultMap[language] === undefined) {
|
|
||||||
resultMap[language] = [];
|
|
||||||
}
|
|
||||||
resultMap[language].push(...Object.keys(queries).filter((q) => !queryIsDisabled(language, q)));
|
|
||||||
}
|
|
||||||
if (errorOnInvalidQueries) {
|
|
||||||
validateQueries(resolvedQueries);
|
validateQueries(resolvedQueries);
|
||||||
}
|
}
|
||||||
|
for (const [language, queryPaths] of Object.entries(resolvedQueries.byLanguage)) {
|
||||||
|
if (resultMap[language] === undefined) {
|
||||||
|
resultMap[language] = {
|
||||||
|
builtin: [],
|
||||||
|
custom: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const queries = Object.keys(queryPaths).filter((q) => !queryIsDisabled(language, q));
|
||||||
|
if (extraSearchPath !== undefined) {
|
||||||
|
resultMap[language].custom.push(...queries);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resultMap[language].builtin.push(...queries);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the set of queries included by default.
|
* Get the set of queries included by default.
|
||||||
*/
|
*/
|
||||||
async function addDefaultQueries(codeQL, languages, resultMap) {
|
async function addDefaultQueries(codeQL, languages, resultMap) {
|
||||||
const suites = languages.map((l) => `${l}-code-scanning.qls`);
|
const suites = languages.map((l) => `${l}-code-scanning.qls`);
|
||||||
await runResolveQueries(codeQL, resultMap, suites, undefined, false);
|
await runResolveQueries(codeQL, resultMap, suites, undefined);
|
||||||
}
|
}
|
||||||
// The set of acceptable values for built-in suites from the codeql bundle
|
// The set of acceptable values for built-in suites from the codeql bundle
|
||||||
const builtinSuites = ["security-extended", "security-and-quality"];
|
const builtinSuites = ["security-extended", "security-and-quality"];
|
||||||
@@ -90,7 +104,7 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, suiteName, c
|
|||||||
throw new Error(getQueryUsesInvalid(configFile, suiteName));
|
throw new Error(getQueryUsesInvalid(configFile, suiteName));
|
||||||
}
|
}
|
||||||
const suites = languages.map((l) => `${l}-${suiteName}.qls`);
|
const suites = languages.map((l) => `${l}-${suiteName}.qls`);
|
||||||
await runResolveQueries(codeQL, resultMap, suites, undefined, false);
|
await runResolveQueries(codeQL, resultMap, suites, undefined);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieve the set of queries at localQueryPath and add them to resultMap.
|
* Retrieve the set of queries at localQueryPath and add them to resultMap.
|
||||||
@@ -109,7 +123,7 @@ async function addLocalQueries(codeQL, resultMap, localQueryPath, checkoutPath,
|
|||||||
if (!(absoluteQueryPath + path.sep).startsWith(fs.realpathSync(checkoutPath) + path.sep)) {
|
if (!(absoluteQueryPath + path.sep).startsWith(fs.realpathSync(checkoutPath) + path.sep)) {
|
||||||
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
||||||
}
|
}
|
||||||
await runResolveQueries(codeQL, resultMap, [absoluteQueryPath], checkoutPath, true);
|
await runResolveQueries(codeQL, resultMap, [absoluteQueryPath], checkoutPath);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieve the set of queries at the referenced remote repo and add them to resultMap.
|
* Retrieve the set of queries at the referenced remote repo and add them to resultMap.
|
||||||
@@ -137,7 +151,7 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, githubUrl
|
|||||||
const queryPath = tok.length > 2
|
const queryPath = tok.length > 2
|
||||||
? path.join(checkoutPath, tok.slice(2).join("/"))
|
? path.join(checkoutPath, tok.slice(2).join("/"))
|
||||||
: checkoutPath;
|
: checkoutPath;
|
||||||
await runResolveQueries(codeQL, resultMap, [queryPath], checkoutPath, true);
|
await runResolveQueries(codeQL, resultMap, [queryPath], checkoutPath);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Parse a query 'uses' field to a discrete set of query files and update resultMap.
|
* Parse a query 'uses' field to a discrete set of query files and update resultMap.
|
||||||
@@ -171,7 +185,7 @@ async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir,
|
|||||||
const pathStarsRegex = /.*(?:\*\*[^/].*|\*\*$|[^/]\*\*.*)/;
|
const pathStarsRegex = /.*(?:\*\*[^/].*|\*\*$|[^/]\*\*.*)/;
|
||||||
// Characters that are supported by filters in workflows, but not by us.
|
// Characters that are supported by filters in workflows, but not by us.
|
||||||
// See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
|
// See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
|
||||||
const filterPatternCharactersRegex = /.*[\?\+\[\]!].*/;
|
const filterPatternCharactersRegex = /.*[?+[\]!].*/;
|
||||||
// Checks that a paths of paths-ignore entry is valid, possibly modifying it
|
// Checks that a paths of paths-ignore entry is valid, possibly modifying it
|
||||||
// to make it valid, or if not possible then throws an error.
|
// to make it valid, or if not possible then throws an error.
|
||||||
function validateAndSanitisePath(originalPath, propertyName, configFile, logger) {
|
function validateAndSanitisePath(originalPath, propertyName, configFile, logger) {
|
||||||
@@ -454,28 +468,30 @@ async function loadConfig(languagesInput, queriesInput, configFile, repository,
|
|||||||
if (!(parsedYAML[PATHS_IGNORE_PROPERTY] instanceof Array)) {
|
if (!(parsedYAML[PATHS_IGNORE_PROPERTY] instanceof Array)) {
|
||||||
throw new Error(getPathsIgnoreInvalid(configFile));
|
throw new Error(getPathsIgnoreInvalid(configFile));
|
||||||
}
|
}
|
||||||
parsedYAML[PATHS_IGNORE_PROPERTY].forEach((path) => {
|
for (const path of parsedYAML[PATHS_IGNORE_PROPERTY]) {
|
||||||
if (typeof path !== "string" || path === "") {
|
if (typeof path !== "string" || path === "") {
|
||||||
throw new Error(getPathsIgnoreInvalid(configFile));
|
throw new Error(getPathsIgnoreInvalid(configFile));
|
||||||
}
|
}
|
||||||
pathsIgnore.push(validateAndSanitisePath(path, PATHS_IGNORE_PROPERTY, configFile, logger));
|
pathsIgnore.push(validateAndSanitisePath(path, PATHS_IGNORE_PROPERTY, configFile, logger));
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
if (PATHS_PROPERTY in parsedYAML) {
|
if (PATHS_PROPERTY in parsedYAML) {
|
||||||
if (!(parsedYAML[PATHS_PROPERTY] instanceof Array)) {
|
if (!(parsedYAML[PATHS_PROPERTY] instanceof Array)) {
|
||||||
throw new Error(getPathsInvalid(configFile));
|
throw new Error(getPathsInvalid(configFile));
|
||||||
}
|
}
|
||||||
parsedYAML[PATHS_PROPERTY].forEach((path) => {
|
for (const path of parsedYAML[PATHS_PROPERTY]) {
|
||||||
if (typeof path !== "string" || path === "") {
|
if (typeof path !== "string" || path === "") {
|
||||||
throw new Error(getPathsInvalid(configFile));
|
throw new Error(getPathsInvalid(configFile));
|
||||||
}
|
}
|
||||||
paths.push(validateAndSanitisePath(path, PATHS_PROPERTY, configFile, logger));
|
paths.push(validateAndSanitisePath(path, PATHS_PROPERTY, configFile, logger));
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
// The list of queries should not be empty for any language. If it is then
|
// The list of queries should not be empty for any language. If it is then
|
||||||
// it is a user configuration error.
|
// it is a user configuration error.
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
if (queries[language] === undefined || queries[language].length === 0) {
|
if (queries[language] === undefined ||
|
||||||
|
(queries[language].builtin.length === 0 &&
|
||||||
|
queries[language].custom.length === 0)) {
|
||||||
throw new Error(`Did not detect any queries to run for ${language}. ` +
|
throw new Error(`Did not detect any queries to run for ${language}. ` +
|
||||||
"Please make sure that the default queries are enabled, or you are specifying queries to run.");
|
"Please make sure that the default queries are enabled, or you are specifying queries to run.");
|
||||||
}
|
}
|
||||||
@@ -540,7 +556,7 @@ async function getRemoteConfig(configFile, githubAuth, githubUrl) {
|
|||||||
}
|
}
|
||||||
const response = await api
|
const response = await api
|
||||||
.getApiClient(githubAuth, githubUrl, true)
|
.getApiClient(githubAuth, githubUrl, true)
|
||||||
.repos.getContents({
|
.repos.getContent({
|
||||||
owner: pieces.groups.owner,
|
owner: pieces.groups.owner,
|
||||||
repo: pieces.groups.repo,
|
repo: pieces.groups.repo,
|
||||||
path: pieces.groups.path,
|
path: pieces.groups.path,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
60
lib/config-utils.test.js
generated
60
lib/config-utils.test.js
generated
@@ -10,10 +10,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const github = __importStar(require("@actions/github"));
|
|
||||||
const ava_1 = __importDefault(require("ava"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const github = __importStar(require("@actions/github"));
|
||||||
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const sinon_1 = __importDefault(require("sinon"));
|
const sinon_1 = __importDefault(require("sinon"));
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
@@ -31,19 +31,19 @@ function createConfigFile(inputFileContents, tmpDir) {
|
|||||||
}
|
}
|
||||||
function mockGetContents(content) {
|
function mockGetContents(content) {
|
||||||
// Passing an auth token is required, so we just use a dummy value
|
// Passing an auth token is required, so we just use a dummy value
|
||||||
const client = new github.GitHub("123");
|
const client = github.getOctokit("123");
|
||||||
const response = {
|
const response = {
|
||||||
data: content,
|
data: content,
|
||||||
};
|
};
|
||||||
const spyGetContents = sinon_1.default
|
const spyGetContents = sinon_1.default
|
||||||
.stub(client.repos, "getContents")
|
.stub(client.repos, "getContent")
|
||||||
.resolves(response);
|
.resolves(response);
|
||||||
sinon_1.default.stub(api, "getApiClient").value(() => client);
|
sinon_1.default.stub(api, "getApiClient").value(() => client);
|
||||||
return spyGetContents;
|
return spyGetContents;
|
||||||
}
|
}
|
||||||
function mockListLanguages(languages) {
|
function mockListLanguages(languages) {
|
||||||
// Passing an auth token is required, so we just use a dummy value
|
// Passing an auth token is required, so we just use a dummy value
|
||||||
const client = new github.GitHub("123");
|
const client = github.getOctokit("123");
|
||||||
const response = {
|
const response = {
|
||||||
data: {},
|
data: {},
|
||||||
};
|
};
|
||||||
@@ -163,7 +163,12 @@ ava_1.default("load non-empty input", async (t) => {
|
|||||||
// And the config we expect it to parse to
|
// And the config we expect it to parse to
|
||||||
const expectedConfig = {
|
const expectedConfig = {
|
||||||
languages: [languages_1.Language.javascript],
|
languages: [languages_1.Language.javascript],
|
||||||
queries: { javascript: ["/foo/a.ql", "/bar/b.ql"] },
|
queries: {
|
||||||
|
javascript: {
|
||||||
|
builtin: [],
|
||||||
|
custom: ["/foo/a.ql", "/bar/b.ql"],
|
||||||
|
},
|
||||||
|
},
|
||||||
pathsIgnore: ["a", "b"],
|
pathsIgnore: ["a", "b"],
|
||||||
paths: ["c/d"],
|
paths: ["c/d"],
|
||||||
originalUserInput: {
|
originalUserInput: {
|
||||||
@@ -231,9 +236,9 @@ ava_1.default("Default queries are used", async (t) => {
|
|||||||
*/
|
*/
|
||||||
function queriesToResolvedQueryForm(queries) {
|
function queriesToResolvedQueryForm(queries) {
|
||||||
const dummyResolvedQueries = {};
|
const dummyResolvedQueries = {};
|
||||||
queries.forEach((q) => {
|
for (const q of queries) {
|
||||||
dummyResolvedQueries[q] = {};
|
dummyResolvedQueries[q] = {};
|
||||||
});
|
}
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
javascript: dummyResolvedQueries,
|
javascript: dummyResolvedQueries,
|
||||||
@@ -266,9 +271,10 @@ ava_1.default("Queries can be specified in config file", async (t) => {
|
|||||||
t.deepEqual(resolveQueriesArgs[1].queries.length, 1);
|
t.deepEqual(resolveQueriesArgs[1].queries.length, 1);
|
||||||
t.regex(resolveQueriesArgs[1].queries[0], /.*\/foo$/);
|
t.regex(resolveQueriesArgs[1].queries[0], /.*\/foo$/);
|
||||||
// Now check that the end result contains the default queries and the query from config
|
// Now check that the end result contains the default queries and the query from config
|
||||||
t.deepEqual(config.queries["javascript"].length, 2);
|
t.deepEqual(config.queries["javascript"].builtin.length, 1);
|
||||||
t.regex(config.queries["javascript"][0], /javascript-code-scanning.qls$/);
|
t.deepEqual(config.queries["javascript"].custom.length, 1);
|
||||||
t.regex(config.queries["javascript"][1], /.*\/foo$/);
|
t.regex(config.queries["javascript"].builtin[0], /javascript-code-scanning.qls$/);
|
||||||
|
t.regex(config.queries["javascript"].custom[0], /.*\/foo$/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ava_1.default("Queries from config file can be overridden in workflow file", async (t) => {
|
ava_1.default("Queries from config file can be overridden in workflow file", async (t) => {
|
||||||
@@ -298,9 +304,10 @@ ava_1.default("Queries from config file can be overridden in workflow file", asy
|
|||||||
t.deepEqual(resolveQueriesArgs[1].queries.length, 1);
|
t.deepEqual(resolveQueriesArgs[1].queries.length, 1);
|
||||||
t.regex(resolveQueriesArgs[1].queries[0], /.*\/override$/);
|
t.regex(resolveQueriesArgs[1].queries[0], /.*\/override$/);
|
||||||
// Now check that the end result contains only the default queries and the override query
|
// Now check that the end result contains only the default queries and the override query
|
||||||
t.deepEqual(config.queries["javascript"].length, 2);
|
t.deepEqual(config.queries["javascript"].builtin.length, 1);
|
||||||
t.regex(config.queries["javascript"][0], /javascript-code-scanning.qls$/);
|
t.deepEqual(config.queries["javascript"].custom.length, 1);
|
||||||
t.regex(config.queries["javascript"][1], /.*\/override$/);
|
t.regex(config.queries["javascript"].builtin[0], /javascript-code-scanning.qls$/);
|
||||||
|
t.regex(config.queries["javascript"].custom[0], /.*\/override$/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ava_1.default("Queries in workflow file can be used in tandem with the 'disable default queries' option", async (t) => {
|
ava_1.default("Queries in workflow file can be used in tandem with the 'disable default queries' option", async (t) => {
|
||||||
@@ -329,8 +336,9 @@ ava_1.default("Queries in workflow file can be used in tandem with the 'disable
|
|||||||
t.deepEqual(resolveQueriesArgs[0].queries.length, 1);
|
t.deepEqual(resolveQueriesArgs[0].queries.length, 1);
|
||||||
t.regex(resolveQueriesArgs[0].queries[0], /.*\/workflow-query$/);
|
t.regex(resolveQueriesArgs[0].queries[0], /.*\/workflow-query$/);
|
||||||
// Now check that the end result contains only the workflow query, and not the default one
|
// Now check that the end result contains only the workflow query, and not the default one
|
||||||
t.deepEqual(config.queries["javascript"].length, 1);
|
t.deepEqual(config.queries["javascript"].builtin.length, 0);
|
||||||
t.regex(config.queries["javascript"][0], /.*\/workflow-query$/);
|
t.deepEqual(config.queries["javascript"].custom.length, 1);
|
||||||
|
t.regex(config.queries["javascript"].custom[0], /.*\/workflow-query$/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ava_1.default("Multiple queries can be specified in workflow file, no config file required", async (t) => {
|
ava_1.default("Multiple queries can be specified in workflow file, no config file required", async (t) => {
|
||||||
@@ -356,10 +364,11 @@ ava_1.default("Multiple queries can be specified in workflow file, no config fil
|
|||||||
t.regex(resolveQueriesArgs[1].queries[0], /.*\/override1$/);
|
t.regex(resolveQueriesArgs[1].queries[0], /.*\/override1$/);
|
||||||
t.regex(resolveQueriesArgs[2].queries[0], /.*\/override2$/);
|
t.regex(resolveQueriesArgs[2].queries[0], /.*\/override2$/);
|
||||||
// Now check that the end result contains both the queries from the workflow, as well as the defaults
|
// Now check that the end result contains both the queries from the workflow, as well as the defaults
|
||||||
t.deepEqual(config.queries["javascript"].length, 3);
|
t.deepEqual(config.queries["javascript"].builtin.length, 1);
|
||||||
t.regex(config.queries["javascript"][0], /javascript-code-scanning.qls$/);
|
t.deepEqual(config.queries["javascript"].custom.length, 2);
|
||||||
t.regex(config.queries["javascript"][1], /.*\/override1$/);
|
t.regex(config.queries["javascript"].builtin[0], /javascript-code-scanning.qls$/);
|
||||||
t.regex(config.queries["javascript"][2], /.*\/override2$/);
|
t.regex(config.queries["javascript"].custom[0], /.*\/override1$/);
|
||||||
|
t.regex(config.queries["javascript"].custom[1], /.*\/override2$/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ava_1.default("Queries in workflow file can be added to the set of queries without overriding config file", async (t) => {
|
ava_1.default("Queries in workflow file can be added to the set of queries without overriding config file", async (t) => {
|
||||||
@@ -397,11 +406,12 @@ ava_1.default("Queries in workflow file can be added to the set of queries witho
|
|||||||
t.deepEqual(resolveQueriesArgs[3].queries.length, 1);
|
t.deepEqual(resolveQueriesArgs[3].queries.length, 1);
|
||||||
t.regex(resolveQueriesArgs[3].queries[0], /.*\/foo$/);
|
t.regex(resolveQueriesArgs[3].queries[0], /.*\/foo$/);
|
||||||
// Now check that the end result contains all the queries
|
// Now check that the end result contains all the queries
|
||||||
t.deepEqual(config.queries["javascript"].length, 4);
|
t.deepEqual(config.queries["javascript"].builtin.length, 1);
|
||||||
t.regex(config.queries["javascript"][0], /javascript-code-scanning.qls$/);
|
t.deepEqual(config.queries["javascript"].custom.length, 3);
|
||||||
t.regex(config.queries["javascript"][1], /.*\/additional1$/);
|
t.regex(config.queries["javascript"].builtin[0], /javascript-code-scanning.qls$/);
|
||||||
t.regex(config.queries["javascript"][2], /.*\/additional2$/);
|
t.regex(config.queries["javascript"].custom[0], /.*\/additional1$/);
|
||||||
t.regex(config.queries["javascript"][3], /.*\/foo$/);
|
t.regex(config.queries["javascript"].custom[1], /.*\/additional2$/);
|
||||||
|
t.regex(config.queries["javascript"].custom[2], /.*\/foo$/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ava_1.default("Invalid queries in workflow file handled correctly", async (t) => {
|
ava_1.default("Invalid queries in workflow file handled correctly", async (t) => {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
lib/external-queries.js
generated
2
lib/external-queries.js
generated
@@ -7,9 +7,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
/**
|
/**
|
||||||
* Check out repository at the given ref, and return the directory of the checkout.
|
* Check out repository at the given ref, and return the directory of the checkout.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"external-queries.js","sourceRoot":"","sources":["../src/external-queries.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0EAA4D;AAC5D,uCAAyB;AACzB,2CAA6B;AAI7B;;GAEG;AACI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AAG,CAAC,CAAC;IAE7D,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QACzC,wGAAwG;QACxG,MAAM,IAAI,KAAK,CACb,IAAI,UAAU,IAAI,GAAG,4CAA4C,CAClE,CAAC;KACH;IAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACpC,MAAM,OAAO,GAAG,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;QAC7C,MAAM,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE;YACtC,OAAO;YACP,OAAO;YACP,gBAAgB;SACjB,CAAC,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE;YACtC,eAAe,gBAAgB,EAAE;YACjC,aAAa,gBAAgB,OAAO;YACpC,UAAU;YACV,GAAG;SACJ,CAAC,CAAC,IAAI,EAAE,CAAC;KACX;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAlCD,gEAkCC"}
|
||||||
4
lib/external-queries.test.js
generated
4
lib/external-queries.test.js
generated
@@ -10,10 +10,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
|
||||||
const ava_1 = __importDefault(require("ava"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const externalQueries = __importStar(require("./external-queries"));
|
const externalQueries = __importStar(require("./external-queries"));
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"external-queries.test.js","sourceRoot":"","sources":["../src/external-queries.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0EAA4D;AAC5D,8CAAuB;AACvB,uCAAyB;AACzB,2CAA6B;AAE7B,oEAAsD;AACtD,uCAA4C;AAC5C,mDAA6C;AAC7C,6CAA+B;AAE/B,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,yBAAyB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC1C,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACrC,kDAAkD;QAClD,mFAAmF;QACnF,gDAAgD;QAChD,wCAAwC;QACxC,8EAA8E;QAC9E,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,WAAW,CAAC;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE/C,oDAAoD;QACpD,oCAAoC;QACpC,2DAA2D;QAC3D,MAAM,MAAM,GAAG,KAAK,WAAW,OAAiB;YAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,OAAO,GAAG;gBACR,aAAa,UAAU,EAAE;gBACzB,eAAe,QAAQ,EAAE;gBACzB,GAAG,OAAO;aACX,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACjD,IAAI;gBACF,MAAM,IA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0B,CAC9C,QAAQ,EACR,UAAU,EACV,UAAU,eAAe,EAAE,EAC3B,MAAM,EACN,yBAAe,CAAC,IAAI,CAAC,CACtB,CAAC;QACF,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
8
lib/fingerprints.js
generated
8
lib/fingerprints.js
generated
@@ -229,14 +229,16 @@ function addFingerprints(sarifContents, checkoutPath, logger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now hash each file that was found
|
// Now hash each file that was found
|
||||||
Object.entries(callbacksByFile).forEach(([filepath, callbacks]) => {
|
for (const [filepath, callbacks] of Object.entries(callbacksByFile)) {
|
||||||
// A callback that forwards the hash to all other callbacks for that file
|
// A callback that forwards the hash to all other callbacks for that file
|
||||||
const teeCallback = function (lineNumber, hash) {
|
const teeCallback = function (lineNumber, hash) {
|
||||||
Object.values(callbacks).forEach((c) => c(lineNumber, hash));
|
for (const c of Object.values(callbacks)) {
|
||||||
|
c(lineNumber, hash);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const fileContents = fs.readFileSync(filepath).toString();
|
const fileContents = fs.readFileSync(filepath).toString();
|
||||||
hash(teeCallback, fileContents);
|
hash(teeCallback, fileContents);
|
||||||
});
|
}
|
||||||
return JSON.stringify(sarif);
|
return JSON.stringify(sarif);
|
||||||
}
|
}
|
||||||
exports.addFingerprints = addFingerprints;
|
exports.addFingerprints = addFingerprints;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
8
lib/fingerprints.test.js
generated
8
lib/fingerprints.test.js
generated
@@ -1,7 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@@ -9,10 +6,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const ava_1 = __importDefault(require("ava"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const fingerprints = __importStar(require("./fingerprints"));
|
const fingerprints = __importStar(require("./fingerprints"));
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
52
lib/init-action.js
generated
52
lib/init-action.js
generated
@@ -8,32 +8,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const init_1 = require("./init");
|
const init_1 = require("./init");
|
||||||
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
const repository_1 = require("./repository");
|
||||||
const util = __importStar(require("./util"));
|
|
||||||
async function sendSuccessStatusReport(startedAt, config) {
|
async function sendSuccessStatusReport(startedAt, config) {
|
||||||
const statusReportBase = await util.createStatusReportBase("init", "success", startedAt);
|
var _a;
|
||||||
|
const statusReportBase = await actionsUtil.createStatusReportBase("init", "success", startedAt);
|
||||||
const languages = config.languages.join(",");
|
const languages = config.languages.join(",");
|
||||||
const workflowLanguages = core.getInput("languages", { required: false });
|
const workflowLanguages = actionsUtil.getOptionalInput("languages");
|
||||||
const paths = (config.originalUserInput.paths || []).join(",");
|
const paths = (config.originalUserInput.paths || []).join(",");
|
||||||
const pathsIgnore = (config.originalUserInput["paths-ignore"] || []).join(",");
|
const pathsIgnore = (config.originalUserInput["paths-ignore"] || []).join(",");
|
||||||
const disableDefaultQueries = config.originalUserInput["disable-default-queries"]
|
const disableDefaultQueries = config.originalUserInput["disable-default-queries"]
|
||||||
? languages
|
? languages
|
||||||
: "";
|
: "";
|
||||||
const queries = (config.originalUserInput.queries || [])
|
const queries = [];
|
||||||
.map((q) => q.uses)
|
let queriesInput = (_a = actionsUtil.getOptionalInput("queries")) === null || _a === void 0 ? void 0 : _a.trim();
|
||||||
.join(",");
|
if (queriesInput === undefined || queriesInput.startsWith("+")) {
|
||||||
|
queries.push(...(config.originalUserInput.queries || []).map((q) => q.uses));
|
||||||
|
}
|
||||||
|
if (queriesInput !== undefined) {
|
||||||
|
queriesInput = queriesInput.startsWith("+")
|
||||||
|
? queriesInput.substr(1)
|
||||||
|
: queriesInput;
|
||||||
|
queries.push(...queriesInput.split(","));
|
||||||
|
}
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
languages,
|
languages,
|
||||||
workflow_languages: workflowLanguages,
|
workflow_languages: workflowLanguages || "",
|
||||||
paths,
|
paths,
|
||||||
paths_ignore: pathsIgnore,
|
paths_ignore: pathsIgnore,
|
||||||
disable_default_queries: disableDefaultQueries,
|
disable_default_queries: disableDefaultQueries,
|
||||||
queries,
|
queries: queries.join(","),
|
||||||
};
|
};
|
||||||
await util.sendStatusReport(statusReport);
|
await actionsUtil.sendStatusReport(statusReport);
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
@@ -41,17 +51,25 @@ async function run() {
|
|||||||
let config;
|
let config;
|
||||||
let codeql;
|
let codeql;
|
||||||
try {
|
try {
|
||||||
util.prepareLocalRunEnvironment();
|
actionsUtil.prepareLocalRunEnvironment();
|
||||||
if (!(await util.sendStatusReport(await util.createStatusReportBase("init", "starting", startedAt), true))) {
|
if (!(await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("init", "starting", startedAt), true))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
codeql = await init_1.initCodeQL(core.getInput("tools"), core.getInput("token"), util.getRequiredEnvParam("GITHUB_SERVER_URL"), util.getRequiredEnvParam("RUNNER_TEMP"), util.getRequiredEnvParam("RUNNER_TOOL_CACHE"), "actions", logger);
|
codeql = await init_1.initCodeQL(actionsUtil.getOptionalInput("tools"), actionsUtil.getRequiredInput("token"), actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"), actionsUtil.getRequiredEnvParam("RUNNER_TEMP"), actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"), "actions", logger);
|
||||||
config = await init_1.initConfig(core.getInput("languages"), core.getInput("queries"), core.getInput("config-file"), repository_1.parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY")), util.getRequiredEnvParam("RUNNER_TEMP"), util.getRequiredEnvParam("RUNNER_TOOL_CACHE"), codeql, util.getRequiredEnvParam("GITHUB_WORKSPACE"), core.getInput("token"), util.getRequiredEnvParam("GITHUB_SERVER_URL"), logger);
|
config = await init_1.initConfig(actionsUtil.getOptionalInput("languages"), actionsUtil.getOptionalInput("queries"), actionsUtil.getOptionalInput("config-file"), repository_1.parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")), actionsUtil.getRequiredEnvParam("RUNNER_TEMP"), actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"), codeql, actionsUtil.getRequiredEnvParam("GITHUB_WORKSPACE"), actionsUtil.getRequiredInput("token"), actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"), logger);
|
||||||
|
if (config.languages.includes(languages_1.Language.python)) {
|
||||||
|
try {
|
||||||
|
await init_1.installPythonDeps(codeql, logger);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
logger.warning(`${err.message} You can call this action with 'setup-python-dependencies: false' to disable this process`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.setFailed(e.message);
|
core.setFailed(e.message);
|
||||||
console.log(e);
|
console.log(e);
|
||||||
await util.sendStatusReport(await util.createStatusReportBase("init", "aborted", startedAt, e.message));
|
await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("init", "aborted", startedAt, e.message));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -66,7 +84,9 @@ async function run() {
|
|||||||
core.exportVariable("CODEQL_RAM", codeqlRam);
|
core.exportVariable("CODEQL_RAM", codeqlRam);
|
||||||
const tracerConfig = await init_1.runInit(codeql, config);
|
const tracerConfig = await init_1.runInit(codeql, config);
|
||||||
if (tracerConfig !== undefined) {
|
if (tracerConfig !== undefined) {
|
||||||
Object.entries(tracerConfig.env).forEach(([key, value]) => core.exportVariable(key, value));
|
for (const [key, value] of Object.entries(tracerConfig.env)) {
|
||||||
|
core.exportVariable(key, value);
|
||||||
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
await init_1.injectWindowsTracer("Runner.Worker.exe", undefined, config, codeql, tracerConfig);
|
await init_1.injectWindowsTracer("Runner.Worker.exe", undefined, config, codeql, tracerConfig);
|
||||||
}
|
}
|
||||||
@@ -75,7 +95,7 @@ async function run() {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
await util.sendStatusReport(await util.createStatusReportBase("init", "failure", startedAt, error.message, error.stack));
|
await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("init", "failure", startedAt, error.message, error.stack));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await sendSuccessStatusReport(startedAt, config);
|
await sendSuccessStatusReport(startedAt, config);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init-action.js","sourceRoot":"","sources":["../src/init-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAItC,iCAA8E;AAC9E,uCAA6C;AAC7C,6CAAkD;AAClD,6CAA+B;AAkB/B,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,MAA0B;IAE1B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CACxD,MAAM,EACN,SAAS,EACT,SAAS,CACV,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,CAA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AE,SAAS,CAAC,CAAC;QAE7C,MAAM,YAAY,GAAG,MAAM,cAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;gBAC3D,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACjC;YAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;gBAChC,MAAM,0BAAmB,CACvB,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,MAAM,EACN,YAAY,CACb,CAAC;aACH;SACF;KACF;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,WAAW,CAAC,gBAAgB,CAChC,MAAM,WAAW,CAAC,sBAAsB,CACtC,MAAM,EACN,SAAS,EACT,SAAS,EACT,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CACF,CAAC;QACF,OAAO;KACR;IACD,MAAM,uBAAuB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IAChB,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||||
33
lib/init.js
generated
33
lib/init.js
generated
@@ -7,9 +7,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
@@ -121,4 +121,35 @@ async function injectWindowsTracer(processName, processLevel, config, codeql, tr
|
|||||||
], { env: { ODASA_TRACER_CONFIGURATION: tracerConfig.spec } }).exec();
|
], { env: { ODASA_TRACER_CONFIGURATION: tracerConfig.spec } }).exec();
|
||||||
}
|
}
|
||||||
exports.injectWindowsTracer = injectWindowsTracer;
|
exports.injectWindowsTracer = injectWindowsTracer;
|
||||||
|
async function installPythonDeps(codeql, logger) {
|
||||||
|
logger.startGroup("Setup Python dependencies");
|
||||||
|
if (process.platform !== "linux") {
|
||||||
|
logger.info("Currently, auto-installing python dependancies is only supported on linux");
|
||||||
|
logger.endGroup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
||||||
|
// Setup tools on the Github hosted runners
|
||||||
|
if (process.env["ImageOS"] !== undefined) {
|
||||||
|
try {
|
||||||
|
await new toolrunnner.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 dependecies. You can call this action with 'setup-python-dependencies: false' to disable this process.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Install dependencies
|
||||||
|
try {
|
||||||
|
await new toolrunnner.ToolRunner(path.join(scriptsFolder, "auto_install_packages.py"), [path.dirname(codeql.getPath())]).exec();
|
||||||
|
}
|
||||||
|
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.endGroup();
|
||||||
|
}
|
||||||
|
exports.installPythonDeps = installPythonDeps;
|
||||||
//# sourceMappingURL=init.js.map
|
//# sourceMappingURL=init.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0EAA4D;AAC5D,uCAAyB;AACzB,2CAA6B;AAE7B,gEAAkD;AAClD,qCAA+C;AAC/C,4DAA8C;AAG9C,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAAkB,EAClB,SAAiB,EACjB,OAAe,EACf,QAAgB,EAChB,IAAe,EACf,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,oBAAW,CAC9B,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,MAAM,CACP,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AAtBD,gCAsBC;AAEM,KAAK,UAAU,UAAU,CAC9B,cAAkC,EAClC,YAAgC,EAChC,UAA8B,EAC9B,UAAyB,EACzB,OAAe,EACf,YAAoB,EACpB,MAAc,EACd,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,UAAU,CACzC,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QAClB,OAAO;KACR;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEjE,2CAA2C;IAC3C,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE;QACxC,IAAI;YACF,MAAM,IAAI,WAAW,CAAC,UAAU,CAC9B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAC7C,CAAC,IAAI,EAAE,CAAC;SACV;QAAC,OAAO,CAAC,EAAE;YACV,mGAAmG;YACnG,uDAAuD;YACvD,MAAM,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,CACZ,kLAAkL,CACnL,CAAC;SACH;KACF;IAED,uBAAuB;IACvB,IAAI;QACF,MAAM,IAAI,WAAW,CAAC,UAAU,CAC9B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,0BAA0B,CAAC,EACpD,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CACjC,CAAC,IAAI,EAAE,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CACZ,+IAA+I,CAChJ,CAAC;KACH;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AA1CD,8CA0CC"}
|
||||||
32
lib/runner.js
generated
32
lib/runner.js
generated
@@ -7,10 +7,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const commander_1 = require("commander");
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const commander_1 = require("commander");
|
||||||
const analyze_1 = require("./analyze");
|
const analyze_1 = require("./analyze");
|
||||||
const autobuild_1 = require("./autobuild");
|
const autobuild_1 = require("./autobuild");
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
@@ -23,24 +23,6 @@ const upload_lib = __importStar(require("./upload-lib"));
|
|||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
const program = new commander_1.Command();
|
const program = new commander_1.Command();
|
||||||
program.version("0.0.1");
|
program.version("0.0.1");
|
||||||
function parseGithubUrl(inputUrl) {
|
|
||||||
try {
|
|
||||||
const url = new URL(inputUrl);
|
|
||||||
// If we detect this is trying to be to github.com
|
|
||||||
// then return with a fixed canonical URL.
|
|
||||||
if (url.hostname === "github.com" || url.hostname === "api.github.com") {
|
|
||||||
return "https://github.com";
|
|
||||||
}
|
|
||||||
// Remove the API prefix if it's present
|
|
||||||
if (url.pathname.indexOf("/api/v3") !== -1) {
|
|
||||||
url.pathname = url.pathname.substring(0, url.pathname.indexOf("/api/v3"));
|
|
||||||
}
|
|
||||||
return url.toString();
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
throw new Error(`"${inputUrl}" is not a valid URL`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getTempDir(userInput) {
|
function getTempDir(userInput) {
|
||||||
const tempDir = path.join(userInput || process.cwd(), "codeql-runner");
|
const tempDir = path.join(userInput || process.cwd(), "codeql-runner");
|
||||||
if (!fs.existsSync(tempDir)) {
|
if (!fs.existsSync(tempDir)) {
|
||||||
@@ -61,7 +43,9 @@ function importTracerEnvironment(config) {
|
|||||||
if (!("ODASA_TRACER_CONFIGURATION" in process.env)) {
|
if (!("ODASA_TRACER_CONFIGURATION" in process.env)) {
|
||||||
const jsonEnvFile = path.join(config.tempDir, codeqlEnvJsonFilename);
|
const jsonEnvFile = path.join(config.tempDir, codeqlEnvJsonFilename);
|
||||||
const env = JSON.parse(fs.readFileSync(jsonEnvFile).toString("utf-8"));
|
const env = JSON.parse(fs.readFileSync(jsonEnvFile).toString("utf-8"));
|
||||||
Object.keys(env).forEach((key) => (process.env[key] = env[key]));
|
for (const key of Object.keys(env)) {
|
||||||
|
process.env[key] = env[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Allow the user to specify refs in full refs/heads/branch format
|
// Allow the user to specify refs in full refs/heads/branch format
|
||||||
@@ -124,9 +108,9 @@ program
|
|||||||
codeql = codeql_1.getCodeQL(cmd.codeqlPath);
|
codeql = codeql_1.getCodeQL(cmd.codeqlPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
codeql = await init_1.initCodeQL(undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), tempDir, toolsDir, "runner", logger);
|
codeql = await init_1.initCodeQL(undefined, cmd.githubAuth, util_1.parseGithubUrl(cmd.githubUrl), tempDir, toolsDir, "runner", logger);
|
||||||
}
|
}
|
||||||
const config = await init_1.initConfig(cmd.languages, cmd.queries, cmd.configFile, repository_1.parseRepositoryNwo(cmd.repository), tempDir, toolsDir, codeql, cmd.checkoutPath || process.cwd(), cmd.githubAuth, parseGithubUrl(cmd.githubUrl), logger);
|
const config = await init_1.initConfig(cmd.languages, cmd.queries, cmd.configFile, repository_1.parseRepositoryNwo(cmd.repository), tempDir, toolsDir, codeql, cmd.checkoutPath || process.cwd(), cmd.githubAuth, util_1.parseGithubUrl(cmd.githubUrl), logger);
|
||||||
const tracerConfig = await init_1.runInit(codeql, config);
|
const tracerConfig = await init_1.runInit(codeql, config);
|
||||||
if (tracerConfig === undefined) {
|
if (tracerConfig === undefined) {
|
||||||
return;
|
return;
|
||||||
@@ -235,7 +219,7 @@ program
|
|||||||
throw new Error("Config file could not be found at expected location. " +
|
throw new Error("Config file could not be found at expected location. " +
|
||||||
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
|
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
|
||||||
}
|
}
|
||||||
await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), cmd.upload, "runner", outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), util_1.getThreadsFlag(cmd.threads, logger), config, logger);
|
await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, util_1.parseGithubUrl(cmd.githubUrl), cmd.upload, "runner", outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), util_1.getThreadsFlag(cmd.threads, logger), config, logger);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.error("Analyze failed");
|
logger.error("Analyze failed");
|
||||||
@@ -257,7 +241,7 @@ program
|
|||||||
.action(async (cmd) => {
|
.action(async (cmd) => {
|
||||||
const logger = logging_1.getRunnerLogger(cmd.debug);
|
const logger = logging_1.getRunnerLogger(cmd.debug);
|
||||||
try {
|
try {
|
||||||
await upload_lib.upload(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), "runner", logger);
|
await upload_lib.upload(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, parseRef(cmd.ref), undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, util_1.parseGithubUrl(cmd.githubUrl), "runner", logger);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.error("Upload failed");
|
logger.error("Upload failed");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
lib/toolrunner-error-catcher.js
generated
2
lib/toolrunner-error-catcher.js
generated
@@ -75,7 +75,7 @@ async function toolrunnerErrorCatcher(commandLine, args, matchers, options) {
|
|||||||
return returnState;
|
return returnState;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error(`The process \'${commandLine}\' failed with exit code ${returnState}`);
|
throw new Error(`The process '${commandLine}' failed with exit code ${returnState}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"toolrunner-error-catcher.js","sourceRoot":"","sources":["../src/toolrunner-error-catcher.ts"],"names":[],"mappings":";;;;;;;;;AACA,0EAA4D;AAI5D;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,IAAe,EACf,QAAyB,EACzB,OAAwB;;IAExB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;;YACvB,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,IAAI,aAAA,OAAO,0CAAE,SAAS,0CAAE,MAAM,MAAK,SAAS,EAAE;gBAC5C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAChC;iBAAM;gBACL,4FAA4F;gBAC5F,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC5B;QACH,CAAC;QACD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;;YACvB,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,IAAI,aAAA,OAAO,0CAAE,SAAS,0CAAE,MAAM,MAAK,SAAS,EAAE;gBAC5C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAChC;iBAAM;gBACL,4FAA4F;gBAC5F,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC5B;QACH,CAAC;KACF,CAAC;IAEF,0GAA0G;IAC1G,IAAI,WAA2B,CAAC;IAChC,IAAI;QACF,WAAW,GAAG,MAAM,IAAI,WAAW,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE;YAChE,GAAG,OAAO;YACV,SAAS;YACT,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC,IAAI,EAAE,CAAC;KACX;IAAC,OAAO,CAAC,EAAE;QACV,WAAW,GAAG,CAAC,CAAC;KACjB;IAED,mEAAmE;IACnE,IAAI,WAAW,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAE1C,IAAI,QAAQ,EAAE;QACZ,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,IACE,OAAO,CAAC,QAAQ,KAAK,WAAW,WAChC,OAAO,CAAC,WAAW,0CAAE,IAAI,CAAC,MAAM,EAAC,WACjC,OAAO,CAAC,WAAW,0CAAE,IAAI,CAAC,MAAM,EAAC,EACjC;gBACA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAClC;SACF;KACF;IAED,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,qFAAqF;QACrF,UAAI,OAAO,0CAAE,gBAAgB,EAAE;YAC7B,OAAO,WAAW,CAAC;SACpB;aAAM;YACL,MAAM,IAAI,KAAK,CACb,iBAAiB,WAAW,4BAA4B,WAAW,EAAE,CACtE,CAAC;SACH;KACF;SAAM;QACL,MAAM,WAAW,CAAC;KACnB;AACH,CAAC;AArED,wDAqEC"}
|
{"version":3,"file":"toolrunner-error-catcher.js","sourceRoot":"","sources":["../src/toolrunner-error-catcher.ts"],"names":[],"mappings":";;;;;;;;;AACA,0EAA4D;AAI5D;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,IAAe,EACf,QAAyB,EACzB,OAAwB;;IAExB,IAAI,MAAM,GAAG,EAAE,CAAC;IACh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AI,CAAC,MAAM,EAAC,WACjC,OAAO,CAAC,WAAW,0CAAE,IAAI,CAAC,MAAM,EAAC,EACjC;gBACA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAClC;SACF;KACF;IAED,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,qFAAqF;QACrF,UAAI,OAAO,0CAAE,gBAAgB,EAAE;YAC7B,OAAO,WAAW,CAAC;SACpB;aAAM;YACL,MAAM,IAAI,KAAK,CACb,gBAAgB,WAAW,2BAA2B,WAAW,EAAE,CACpE,CAAC;SACH;KACF;SAAM;QACL,MAAM,WAAW,CAAC;KACnB;AACH,CAAC;AArED,wDAqEC"}
|
||||||
4
lib/tracer-config.js
generated
4
lib/tracer-config.js
generated
@@ -13,13 +13,9 @@ const languages_1 = require("./languages");
|
|||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const CRITICAL_TRACER_VARS = new Set([
|
const CRITICAL_TRACER_VARS = new Set([
|
||||||
"SEMMLE_PRELOAD_libtrace",
|
"SEMMLE_PRELOAD_libtrace",
|
||||||
,
|
|
||||||
"SEMMLE_RUNNER",
|
"SEMMLE_RUNNER",
|
||||||
,
|
|
||||||
"SEMMLE_COPY_EXECUTABLES_ROOT",
|
"SEMMLE_COPY_EXECUTABLES_ROOT",
|
||||||
,
|
|
||||||
"SEMMLE_DEPTRACE_SOCKET",
|
"SEMMLE_DEPTRACE_SOCKET",
|
||||||
,
|
|
||||||
"SEMMLE_JAVA_TOOL_OPTIONS",
|
"SEMMLE_JAVA_TOOL_OPTIONS",
|
||||||
]);
|
]);
|
||||||
async function getTracerConfigForLanguage(codeql, config, language) {
|
async function getTracerConfigForLanguage(codeql, config, language) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tracer-config.js","sourceRoot":"","sources":["../src/tracer-config.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAI7B,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er-config.test.js
generated
@@ -1,7 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@@ -9,10 +6,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const ava_1 = __importDefault(require("ava"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
70
lib/upload-lib.js
generated
70
lib/upload-lib.js
generated
@@ -10,12 +10,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const file_url_1 = __importDefault(require("file-url"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const jsonschema = __importStar(require("jsonschema"));
|
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const zlib_1 = __importDefault(require("zlib"));
|
const zlib_1 = __importDefault(require("zlib"));
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const file_url_1 = __importDefault(require("file-url"));
|
||||||
|
const jsonschema = __importStar(require("jsonschema"));
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const fingerprints = __importStar(require("./fingerprints"));
|
const fingerprints = __importStar(require("./fingerprints"));
|
||||||
const sharedEnv = __importStar(require("./shared-environment"));
|
const sharedEnv = __importStar(require("./shared-environment"));
|
||||||
@@ -34,7 +34,7 @@ function combineSarifFiles(sarifFiles) {
|
|||||||
combinedSarif.version = sarifObject.version;
|
combinedSarif.version = sarifObject.version;
|
||||||
}
|
}
|
||||||
else if (combinedSarif.version !== sarifObject.version) {
|
else if (combinedSarif.version !== sarifObject.version) {
|
||||||
throw `Different SARIF versions encountered: ${combinedSarif.version} and ${sarifObject.version}`;
|
throw new Error(`Different SARIF versions encountered: ${combinedSarif.version} and ${sarifObject.version}`);
|
||||||
}
|
}
|
||||||
combinedSarif.runs.push(...sarifObject.runs);
|
combinedSarif.runs.push(...sarifObject.runs);
|
||||||
}
|
}
|
||||||
@@ -50,50 +50,17 @@ async function uploadPayload(payload, repositoryNwo, githubAuth, githubUrl, mode
|
|||||||
if (testMode) {
|
if (testMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Make up to 4 attempts to upload, and sleep for these
|
|
||||||
// number of seconds between each attempt.
|
|
||||||
// We don't want to backoff too much to avoid wasting action
|
|
||||||
// minutes, but just waiting a little bit could maybe help.
|
|
||||||
const backoffPeriods = [1, 5, 15];
|
|
||||||
const client = api.getApiClient(githubAuth, githubUrl);
|
const client = api.getApiClient(githubAuth, githubUrl);
|
||||||
for (let attempt = 0; attempt <= backoffPeriods.length; attempt++) {
|
const reqURL = mode === "actions"
|
||||||
const reqURL = mode === "actions"
|
? "PUT /repos/:owner/:repo/code-scanning/analysis"
|
||||||
? "PUT /repos/:owner/:repo/code-scanning/analysis"
|
: "POST /repos/:owner/:repo/code-scanning/sarifs";
|
||||||
: "POST /repos/:owner/:repo/code-scanning/sarifs";
|
const response = await client.request(reqURL, {
|
||||||
const response = await client.request(reqURL, {
|
owner: repositoryNwo.owner,
|
||||||
owner: repositoryNwo.owner,
|
repo: repositoryNwo.repo,
|
||||||
repo: repositoryNwo.repo,
|
data: payload,
|
||||||
data: payload,
|
});
|
||||||
});
|
logger.debug(`response status: ${response.status}`);
|
||||||
logger.debug(`response status: ${response.status}`);
|
logger.info("Successfully uploaded results");
|
||||||
const statusCode = response.status;
|
|
||||||
if (statusCode === 202) {
|
|
||||||
logger.info("Successfully uploaded results");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const requestID = response.headers["x-github-request-id"];
|
|
||||||
// On any other status code that's not 5xx mark the upload as failed
|
|
||||||
if (!statusCode || statusCode < 500 || statusCode >= 600) {
|
|
||||||
throw new Error(`Upload failed (${requestID}): (${statusCode}) ${JSON.stringify(response.data)}`);
|
|
||||||
}
|
|
||||||
// On a 5xx status code we may retry the request
|
|
||||||
if (attempt < backoffPeriods.length) {
|
|
||||||
// Log the failure as a warning but don't mark the action as failed yet
|
|
||||||
logger.warning(`Upload attempt (${attempt + 1} of ${backoffPeriods.length + 1}) failed (${requestID}). Retrying in ${backoffPeriods[attempt]} seconds: (${statusCode}) ${JSON.stringify(response.data)}`);
|
|
||||||
// Sleep for the backoff period
|
|
||||||
await new Promise((r) => setTimeout(r, backoffPeriods[attempt] * 1000));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// If the upload fails with 5xx then we assume it is a temporary problem
|
|
||||||
// and not an error that the user has caused or can fix.
|
|
||||||
// We avoid marking the job as failed to avoid breaking CI workflows.
|
|
||||||
throw new Error(`Upload failed (${requestID}): (${statusCode}) ${JSON.stringify(response.data)}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// This case shouldn't ever happen as the final iteration of the loop
|
|
||||||
// will always throw an error instead of exiting to here.
|
|
||||||
throw new Error("Upload failed");
|
|
||||||
}
|
}
|
||||||
// Uploads a single sarif file or a directory of sarif files
|
// Uploads a single sarif file or a directory of sarif files
|
||||||
// depending on what the path happens to refer to.
|
// depending on what the path happens to refer to.
|
||||||
@@ -104,10 +71,13 @@ async function upload(sarifPath, repositoryNwo, commitOid, ref, analysisKey, ana
|
|||||||
throw new Error(`Path does not exist: ${sarifPath}`);
|
throw new Error(`Path does not exist: ${sarifPath}`);
|
||||||
}
|
}
|
||||||
if (fs.lstatSync(sarifPath).isDirectory()) {
|
if (fs.lstatSync(sarifPath).isDirectory()) {
|
||||||
fs.readdirSync(sarifPath)
|
const paths = fs
|
||||||
|
.readdirSync(sarifPath)
|
||||||
.filter((f) => f.endsWith(".sarif"))
|
.filter((f) => f.endsWith(".sarif"))
|
||||||
.map((f) => path.resolve(sarifPath, f))
|
.map((f) => path.resolve(sarifPath, f));
|
||||||
.forEach((f) => sarifFiles.push(f));
|
for (const path of paths) {
|
||||||
|
sarifFiles.push(path);
|
||||||
|
}
|
||||||
if (sarifFiles.length === 0) {
|
if (sarifFiles.length === 0) {
|
||||||
throw new Error(`No SARIF files found to upload in "${sarifPath}".`);
|
throw new Error(`No SARIF files found to upload in "${sarifPath}".`);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
12
lib/upload-sarif-action.js
generated
12
lib/upload-sarif-action.js
generated
@@ -8,31 +8,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
const repository_1 = require("./repository");
|
||||||
const upload_lib = __importStar(require("./upload-lib"));
|
const upload_lib = __importStar(require("./upload-lib"));
|
||||||
const util = __importStar(require("./util"));
|
|
||||||
async function sendSuccessStatusReport(startedAt, uploadStats) {
|
async function sendSuccessStatusReport(startedAt, uploadStats) {
|
||||||
const statusReportBase = await util.createStatusReportBase("upload-sarif", "success", startedAt);
|
const statusReportBase = await actionsUtil.createStatusReportBase("upload-sarif", "success", startedAt);
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
...uploadStats,
|
...uploadStats,
|
||||||
};
|
};
|
||||||
await util.sendStatusReport(statusReport);
|
await actionsUtil.sendStatusReport(statusReport);
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
if (!(await util.sendStatusReport(await util.createStatusReportBase("upload-sarif", "starting", startedAt), true))) {
|
if (!(await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("upload-sarif", "starting", startedAt), true))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const uploadStats = await upload_lib.upload(core.getInput("sarif_file"), repository_1.parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY")), await util.getCommitOid(), util.getRef(), await util.getAnalysisKey(), util.getRequiredEnvParam("GITHUB_WORKFLOW"), util.getWorkflowRunID(), core.getInput("checkout_path"), core.getInput("matrix"), core.getInput("token"), util.getRequiredEnvParam("GITHUB_SERVER_URL"), "actions", logging_1.getActionsLogger());
|
const uploadStats = await upload_lib.upload(actionsUtil.getRequiredInput("sarif_file"), repository_1.parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")), await actionsUtil.getCommitOid(), await actionsUtil.getRef(), await actionsUtil.getAnalysisKey(), actionsUtil.getRequiredEnvParam("GITHUB_WORKFLOW"), actionsUtil.getWorkflowRunID(), actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getRequiredInput("matrix"), actionsUtil.getRequiredInput("token"), actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"), "actions", logging_1.getActionsLogger());
|
||||||
await sendSuccessStatusReport(startedAt, uploadStats);
|
await sendSuccessStatusReport(startedAt, uploadStats);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
await util.sendStatusReport(await util.createStatusReportBase("upload-sarif", "failure", startedAt, error.message, error.stack));
|
await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("upload-sarif", "failure", startedAt, error.message, error.stack));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"upload-sarif-action.js","sourceRoot":"","sources":["../src/upload-sarif-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,uCAA6C;AAC7C,6CAAkD;AAClD,yDAA2C;AAC3C,6CAA+B;AAM/B,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,WAA0C;IAE1C,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CACxD,cAAc,EACd,SAAS,EACT,SAAS,CACV,CAAC;IACF,MAAM,YAAY,GAA4B;QAC5C,GAAG,gBAAgB;QACnB,GAAG,WAAW;KACf,CAAC;IACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IACE,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAC3B,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,UAAU,EAAE,SA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gB,EAAE,CACnB,CAAC;QACF,MAAM,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;KACvD;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,WAAW,CAAC,gBAAgB,CAChC,MAAM,WAAW,CAAC,sBAAsB,CACtC,cAAc,EACd,SAAS,EACT,SAAS,EACT,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CACF,CAAC;QACF,OAAO;KACR;AACH,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IAChB,IAAI,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||||
271
lib/util.js
generated
271
lib/util.js
generated
@@ -7,29 +7,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const api = __importStar(require("./api-client"));
|
|
||||||
const sharedEnv = __importStar(require("./shared-environment"));
|
|
||||||
/**
|
/**
|
||||||
* The URL for github.com.
|
* The URL for github.com.
|
||||||
*/
|
*/
|
||||||
exports.GITHUB_DOTCOM_URL = "https://github.com";
|
exports.GITHUB_DOTCOM_URL = "https://github.com";
|
||||||
/**
|
|
||||||
* Get an environment parameter, but throw an error if it is not set.
|
|
||||||
*/
|
|
||||||
function getRequiredEnvParam(paramName) {
|
|
||||||
const value = process.env[paramName];
|
|
||||||
if (value === undefined || value.length === 0) {
|
|
||||||
throw new Error(`${paramName} environment variable must be set`);
|
|
||||||
}
|
|
||||||
core.debug(`${paramName}=${value}`);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
exports.getRequiredEnvParam = getRequiredEnvParam;
|
|
||||||
/**
|
/**
|
||||||
* Get the extra options for the codeql commands.
|
* Get the extra options for the codeql commands.
|
||||||
*/
|
*/
|
||||||
@@ -53,222 +37,6 @@ function isLocalRun() {
|
|||||||
process.env.CODEQL_LOCAL_RUN !== "0");
|
process.env.CODEQL_LOCAL_RUN !== "0");
|
||||||
}
|
}
|
||||||
exports.isLocalRun = isLocalRun;
|
exports.isLocalRun = isLocalRun;
|
||||||
/**
|
|
||||||
* Ensures all required environment variables are set in the context of a local run.
|
|
||||||
*/
|
|
||||||
function prepareLocalRunEnvironment() {
|
|
||||||
if (!isLocalRun()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
core.debug("Action is running locally.");
|
|
||||||
if (!process.env.GITHUB_JOB) {
|
|
||||||
core.exportVariable("GITHUB_JOB", "UNKNOWN-JOB");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.prepareLocalRunEnvironment = prepareLocalRunEnvironment;
|
|
||||||
/**
|
|
||||||
* Gets the SHA of the commit that is currently checked out.
|
|
||||||
*/
|
|
||||||
async function getCommitOid() {
|
|
||||||
// Try to use git to get the current commit SHA. If that fails then
|
|
||||||
// log but otherwise silently fall back to using the SHA from the environment.
|
|
||||||
// The only time these two values will differ is during analysis of a PR when
|
|
||||||
// the workflow has changed the current commit to the head commit instead of
|
|
||||||
// the merge commit, which must mean that git is available.
|
|
||||||
// Even if this does go wrong, it's not a huge problem for the alerts to
|
|
||||||
// reported on the merge commit.
|
|
||||||
try {
|
|
||||||
let commitOid = "";
|
|
||||||
await new toolrunnner.ToolRunner("git", ["rev-parse", "HEAD"], {
|
|
||||||
silent: true,
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
commitOid += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data) => {
|
|
||||||
process.stderr.write(data);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}).exec();
|
|
||||||
return commitOid.trim();
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
core.info(`Failed to call git to get current commit. Continuing with data from environment: ${e}`);
|
|
||||||
return getRequiredEnvParam("GITHUB_SHA");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.getCommitOid = getCommitOid;
|
|
||||||
/**
|
|
||||||
* Get the path of the currently executing workflow.
|
|
||||||
*/
|
|
||||||
async function getWorkflowPath() {
|
|
||||||
const repo_nwo = getRequiredEnvParam("GITHUB_REPOSITORY").split("/");
|
|
||||||
const owner = repo_nwo[0];
|
|
||||||
const repo = repo_nwo[1];
|
|
||||||
const run_id = Number(getRequiredEnvParam("GITHUB_RUN_ID"));
|
|
||||||
const apiClient = api.getActionsApiClient();
|
|
||||||
const runsResponse = await apiClient.request("GET /repos/:owner/:repo/actions/runs/:run_id", {
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
run_id,
|
|
||||||
});
|
|
||||||
const workflowUrl = runsResponse.data.workflow_url;
|
|
||||||
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
|
|
||||||
return workflowResponse.data.path;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get the workflow run ID.
|
|
||||||
*/
|
|
||||||
function getWorkflowRunID() {
|
|
||||||
const workflowRunID = parseInt(getRequiredEnvParam("GITHUB_RUN_ID"), 10);
|
|
||||||
if (Number.isNaN(workflowRunID)) {
|
|
||||||
throw new Error("GITHUB_RUN_ID must define a non NaN workflow run ID");
|
|
||||||
}
|
|
||||||
return workflowRunID;
|
|
||||||
}
|
|
||||||
exports.getWorkflowRunID = getWorkflowRunID;
|
|
||||||
/**
|
|
||||||
* Get the analysis key paramter for the current job.
|
|
||||||
*
|
|
||||||
* This will combine the workflow path and current job name.
|
|
||||||
* Computing this the first time requires making requests to
|
|
||||||
* the github API, but after that the result will be cached.
|
|
||||||
*/
|
|
||||||
async function getAnalysisKey() {
|
|
||||||
const analysisKeyEnvVar = "CODEQL_ACTION_ANALYSIS_KEY";
|
|
||||||
let analysisKey = process.env[analysisKeyEnvVar];
|
|
||||||
if (analysisKey !== undefined) {
|
|
||||||
return analysisKey;
|
|
||||||
}
|
|
||||||
const workflowPath = await getWorkflowPath();
|
|
||||||
const jobName = getRequiredEnvParam("GITHUB_JOB");
|
|
||||||
analysisKey = `${workflowPath}:${jobName}`;
|
|
||||||
core.exportVariable(analysisKeyEnvVar, analysisKey);
|
|
||||||
return analysisKey;
|
|
||||||
}
|
|
||||||
exports.getAnalysisKey = getAnalysisKey;
|
|
||||||
/**
|
|
||||||
* Get the ref currently being analyzed.
|
|
||||||
*/
|
|
||||||
function getRef() {
|
|
||||||
// Will be in the form "refs/heads/master" on a push event
|
|
||||||
// or in the form "refs/pull/N/merge" on a pull_request event
|
|
||||||
const ref = getRequiredEnvParam("GITHUB_REF");
|
|
||||||
// For pull request refs we want to convert from the 'merge' ref
|
|
||||||
// to the 'head' ref, as that is what we want to analyse.
|
|
||||||
// There should have been some code earlier in the workflow to do
|
|
||||||
// the checkout, but we have no way of verifying that here.
|
|
||||||
const pull_ref_regex = /refs\/pull\/(\d+)\/merge/;
|
|
||||||
if (pull_ref_regex.test(ref)) {
|
|
||||||
return ref.replace(pull_ref_regex, "refs/pull/$1/head");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.getRef = getRef;
|
|
||||||
/**
|
|
||||||
* Compose a StatusReport.
|
|
||||||
*
|
|
||||||
* @param actionName The name of the action, e.g. 'init', 'finish', 'upload-sarif'
|
|
||||||
* @param status The status. Must be 'success', 'failure', or 'starting'
|
|
||||||
* @param startedAt The time this action started executing.
|
|
||||||
* @param cause Cause of failure (only supply if status is 'failure')
|
|
||||||
* @param exception Exception (only supply if status is 'failure')
|
|
||||||
*/
|
|
||||||
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
|
|
||||||
const commitOid = process.env["GITHUB_SHA"] || "";
|
|
||||||
const ref = getRef();
|
|
||||||
const workflowRunIDStr = process.env["GITHUB_RUN_ID"];
|
|
||||||
let workflowRunID = -1;
|
|
||||||
if (workflowRunIDStr) {
|
|
||||||
workflowRunID = parseInt(workflowRunIDStr, 10);
|
|
||||||
}
|
|
||||||
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
|
|
||||||
const jobName = process.env["GITHUB_JOB"] || "";
|
|
||||||
const analysis_key = await getAnalysisKey();
|
|
||||||
let workflowStartedAt = process.env[sharedEnv.CODEQL_WORKFLOW_STARTED_AT];
|
|
||||||
if (workflowStartedAt === undefined) {
|
|
||||||
workflowStartedAt = actionStartedAt.toISOString();
|
|
||||||
core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt);
|
|
||||||
}
|
|
||||||
const statusReport = {
|
|
||||||
workflow_run_id: workflowRunID,
|
|
||||||
workflow_name: workflowName,
|
|
||||||
job_name: jobName,
|
|
||||||
analysis_key,
|
|
||||||
commit_oid: commitOid,
|
|
||||||
ref,
|
|
||||||
action_name: actionName,
|
|
||||||
action_oid: "unknown",
|
|
||||||
started_at: workflowStartedAt,
|
|
||||||
action_started_at: actionStartedAt.toISOString(),
|
|
||||||
status,
|
|
||||||
};
|
|
||||||
// Add optional parameters
|
|
||||||
if (cause) {
|
|
||||||
statusReport.cause = cause;
|
|
||||||
}
|
|
||||||
if (exception) {
|
|
||||||
statusReport.exception = exception;
|
|
||||||
}
|
|
||||||
if (status === "success" || status === "failure" || status === "aborted") {
|
|
||||||
statusReport.completed_at = new Date().toISOString();
|
|
||||||
}
|
|
||||||
const matrix = core.getInput("matrix");
|
|
||||||
if (matrix) {
|
|
||||||
statusReport.matrix_vars = matrix;
|
|
||||||
}
|
|
||||||
return statusReport;
|
|
||||||
}
|
|
||||||
exports.createStatusReportBase = createStatusReportBase;
|
|
||||||
/**
|
|
||||||
* Send a status report to the code_scanning/analysis/status endpoint.
|
|
||||||
*
|
|
||||||
* Optionally checks the response from the API endpoint and sets the action
|
|
||||||
* as failed if the status report failed. This is only expected to be used
|
|
||||||
* when sending a 'starting' report.
|
|
||||||
*
|
|
||||||
* Returns whether sending the status report was successful of not.
|
|
||||||
*/
|
|
||||||
async function sendStatusReport(statusReport, ignoreFailures) {
|
|
||||||
if (getRequiredEnvParam("GITHUB_SERVER_URL") !== exports.GITHUB_DOTCOM_URL) {
|
|
||||||
core.debug("Not sending status report to GitHub Enterprise");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (isLocalRun()) {
|
|
||||||
core.debug("Not sending status report because this is a local run");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const statusReportJSON = JSON.stringify(statusReport);
|
|
||||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
|
||||||
const nwo = getRequiredEnvParam("GITHUB_REPOSITORY");
|
|
||||||
const [owner, repo] = nwo.split("/");
|
|
||||||
const client = api.getActionsApiClient();
|
|
||||||
const statusResponse = await client.request("PUT /repos/:owner/:repo/code-scanning/analysis/status", {
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
data: statusReportJSON,
|
|
||||||
});
|
|
||||||
if (!ignoreFailures) {
|
|
||||||
// If the status report request fails with a 403 or a 404, then this is a deliberate
|
|
||||||
// message from the endpoint that the SARIF upload can be expected to fail too,
|
|
||||||
// so the action should fail to avoid wasting actions minutes.
|
|
||||||
//
|
|
||||||
// Other failure responses (or lack thereof) could be transitory and should not
|
|
||||||
// cause the action to fail.
|
|
||||||
if (statusResponse.status === 403) {
|
|
||||||
core.setFailed("The repo on which this action is running is not opted-in to CodeQL code scanning.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (statusResponse.status === 404) {
|
|
||||||
core.setFailed("Not authorized to used the CodeQL code scanning feature on this repo.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
exports.sendStatusReport = sendStatusReport;
|
|
||||||
/**
|
/**
|
||||||
* Get the array of all the tool names contained in the given sarif contents.
|
* Get the array of all the tool names contained in the given sarif contents.
|
||||||
*
|
*
|
||||||
@@ -383,4 +151,43 @@ function getCodeQLDatabasePath(tempDir, language) {
|
|||||||
return path.resolve(getCodeQLDatabasesDir(tempDir), language);
|
return path.resolve(getCodeQLDatabasesDir(tempDir), language);
|
||||||
}
|
}
|
||||||
exports.getCodeQLDatabasePath = getCodeQLDatabasePath;
|
exports.getCodeQLDatabasePath = getCodeQLDatabasePath;
|
||||||
|
/**
|
||||||
|
* Parses user input of a github.com or GHES URL to a canonical form.
|
||||||
|
* Removes any API prefix or suffix if one is present.
|
||||||
|
*/
|
||||||
|
function parseGithubUrl(inputUrl) {
|
||||||
|
const originalUrl = inputUrl;
|
||||||
|
if (inputUrl.indexOf("://") === -1) {
|
||||||
|
inputUrl = `https://${inputUrl}`;
|
||||||
|
}
|
||||||
|
if (!inputUrl.startsWith("http://") && !inputUrl.startsWith("https://")) {
|
||||||
|
throw new Error(`"${originalUrl}" is not a http or https URL`);
|
||||||
|
}
|
||||||
|
let url;
|
||||||
|
try {
|
||||||
|
url = new URL(inputUrl);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
throw new Error(`"${originalUrl}" is not a valid URL`);
|
||||||
|
}
|
||||||
|
// If we detect this is trying to be to github.com
|
||||||
|
// then return with a fixed canonical URL.
|
||||||
|
if (url.hostname === "github.com" || url.hostname === "api.github.com") {
|
||||||
|
return exports.GITHUB_DOTCOM_URL;
|
||||||
|
}
|
||||||
|
// Remove the API prefix if it's present
|
||||||
|
if (url.pathname.indexOf("/api/v3") !== -1) {
|
||||||
|
url.pathname = url.pathname.substring(0, url.pathname.indexOf("/api/v3"));
|
||||||
|
}
|
||||||
|
// Also consider subdomain isolation on GHES
|
||||||
|
if (url.hostname.startsWith("api.")) {
|
||||||
|
url.hostname = url.hostname.substring(4);
|
||||||
|
}
|
||||||
|
// Normalise path to having a trailing slash for consistency
|
||||||
|
if (!url.pathname.endsWith("/")) {
|
||||||
|
url.pathname = `${url.pathname}/`;
|
||||||
|
}
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
exports.parseGithubUrl = parseGithubUrl;
|
||||||
//# sourceMappingURL=util.js.map
|
//# sourceMappingURL=util.js.map
|
||||||
File diff suppressed because one or more lines are too long
80
lib/util.test.js
generated
80
lib/util.test.js
generated
@@ -1,7 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@@ -9,10 +6,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const ava_1 = __importDefault(require("ava"));
|
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
@@ -24,11 +24,12 @@ ava_1.default("getToolNames", (t) => {
|
|||||||
});
|
});
|
||||||
ava_1.default("getMemoryFlag() should return the correct --ram flag", (t) => {
|
ava_1.default("getMemoryFlag() should return the correct --ram flag", (t) => {
|
||||||
const totalMem = Math.floor(os.totalmem() / (1024 * 1024));
|
const totalMem = Math.floor(os.totalmem() / (1024 * 1024));
|
||||||
const tests = {
|
const tests = [
|
||||||
"": `--ram=${totalMem - 256}`,
|
[undefined, `--ram=${totalMem - 256}`],
|
||||||
"512": "--ram=512",
|
["", `--ram=${totalMem - 256}`],
|
||||||
};
|
["512", "--ram=512"],
|
||||||
for (const [input, expectedFlag] of Object.entries(tests)) {
|
];
|
||||||
|
for (const [input, expectedFlag] of tests) {
|
||||||
const flag = util.getMemoryFlag(input);
|
const flag = util.getMemoryFlag(input);
|
||||||
t.deepEqual(flag, expectedFlag);
|
t.deepEqual(flag, expectedFlag);
|
||||||
}
|
}
|
||||||
@@ -48,13 +49,15 @@ ava_1.default("getAddSnippetsFlag() should return the correct flag", (t) => {
|
|||||||
});
|
});
|
||||||
ava_1.default("getThreadsFlag() should return the correct --threads flag", (t) => {
|
ava_1.default("getThreadsFlag() should return the correct --threads flag", (t) => {
|
||||||
const numCpus = os.cpus().length;
|
const numCpus = os.cpus().length;
|
||||||
const tests = {
|
const tests = [
|
||||||
"0": "--threads=0",
|
["0", "--threads=0"],
|
||||||
"1": "--threads=1",
|
["1", "--threads=1"],
|
||||||
[`${numCpus + 1}`]: `--threads=${numCpus}`,
|
[undefined, `--threads=${numCpus}`],
|
||||||
[`${-numCpus - 1}`]: `--threads=${-numCpus}`,
|
["", `--threads=${numCpus}`],
|
||||||
};
|
[`${numCpus + 1}`, `--threads=${numCpus}`],
|
||||||
for (const [input, expectedFlag] of Object.entries(tests)) {
|
[`${-numCpus - 1}`, `--threads=${-numCpus}`],
|
||||||
|
];
|
||||||
|
for (const [input, expectedFlag] of tests) {
|
||||||
const flag = util.getThreadsFlag(input, logging_1.getRunnerLogger(true));
|
const flag = util.getThreadsFlag(input, logging_1.getRunnerLogger(true));
|
||||||
t.deepEqual(flag, expectedFlag);
|
t.deepEqual(flag, expectedFlag);
|
||||||
}
|
}
|
||||||
@@ -62,10 +65,6 @@ ava_1.default("getThreadsFlag() should return the correct --threads flag", (t) =
|
|||||||
ava_1.default("getThreadsFlag() throws if the threads input is not an integer", (t) => {
|
ava_1.default("getThreadsFlag() throws if the threads input is not an integer", (t) => {
|
||||||
t.throws(() => util.getThreadsFlag("hello!", logging_1.getRunnerLogger(true)));
|
t.throws(() => util.getThreadsFlag("hello!", logging_1.getRunnerLogger(true)));
|
||||||
});
|
});
|
||||||
ava_1.default("getRef() throws on the empty string", (t) => {
|
|
||||||
process.env["GITHUB_REF"] = "";
|
|
||||||
t.throws(util.getRef);
|
|
||||||
});
|
|
||||||
ava_1.default("isLocalRun() runs correctly", (t) => {
|
ava_1.default("isLocalRun() runs correctly", (t) => {
|
||||||
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
|
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
|
||||||
process.env.CODEQL_LOCAL_RUN = "";
|
process.env.CODEQL_LOCAL_RUN = "";
|
||||||
@@ -80,23 +79,6 @@ ava_1.default("isLocalRun() runs correctly", (t) => {
|
|||||||
t.assert(util.isLocalRun());
|
t.assert(util.isLocalRun());
|
||||||
process.env.CODEQL_LOCAL_RUN = origLocalRun;
|
process.env.CODEQL_LOCAL_RUN = origLocalRun;
|
||||||
});
|
});
|
||||||
ava_1.default("prepareEnvironment() when a local run", (t) => {
|
|
||||||
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
|
|
||||||
process.env.CODEQL_LOCAL_RUN = "false";
|
|
||||||
process.env.GITHUB_JOB = "YYY";
|
|
||||||
util.prepareLocalRunEnvironment();
|
|
||||||
// unchanged
|
|
||||||
t.deepEqual(process.env.GITHUB_JOB, "YYY");
|
|
||||||
process.env.CODEQL_LOCAL_RUN = "true";
|
|
||||||
util.prepareLocalRunEnvironment();
|
|
||||||
// unchanged
|
|
||||||
t.deepEqual(process.env.GITHUB_JOB, "YYY");
|
|
||||||
process.env.GITHUB_JOB = "";
|
|
||||||
util.prepareLocalRunEnvironment();
|
|
||||||
// updated
|
|
||||||
t.deepEqual(process.env.GITHUB_JOB, "UNKNOWN-JOB");
|
|
||||||
process.env.CODEQL_LOCAL_RUN = origLocalRun;
|
|
||||||
});
|
|
||||||
ava_1.default("getExtraOptionsEnvParam() succeeds on valid JSON with invalid options (for now)", (t) => {
|
ava_1.default("getExtraOptionsEnvParam() succeeds on valid JSON with invalid options (for now)", (t) => {
|
||||||
const origExtraOptions = process.env.CODEQL_ACTION_EXTRA_OPTIONS;
|
const origExtraOptions = process.env.CODEQL_ACTION_EXTRA_OPTIONS;
|
||||||
const options = { foo: 42 };
|
const options = { foo: 42 };
|
||||||
@@ -117,4 +99,28 @@ ava_1.default("getExtraOptionsEnvParam() fails on invalid JSON", (t) => {
|
|||||||
t.throws(util.getExtraOptionsEnvParam);
|
t.throws(util.getExtraOptionsEnvParam);
|
||||||
process.env.CODEQL_ACTION_EXTRA_OPTIONS = origExtraOptions;
|
process.env.CODEQL_ACTION_EXTRA_OPTIONS = origExtraOptions;
|
||||||
});
|
});
|
||||||
|
ava_1.default("parseGithubUrl", (t) => {
|
||||||
|
t.deepEqual(util.parseGithubUrl("github.com"), "https://github.com");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.com"), "https://github.com");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://api.github.com"), "https://github.com");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.com/foo/bar"), "https://github.com");
|
||||||
|
t.deepEqual(util.parseGithubUrl("github.example.com"), "https://github.example.com/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.example.com"), "https://github.example.com/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://api.github.example.com"), "https://github.example.com/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.example.com/api/v3"), "https://github.example.com/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.example.com:1234"), "https://github.example.com:1234/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://api.github.example.com:1234"), "https://github.example.com:1234/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.example.com:1234/api/v3"), "https://github.example.com:1234/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.example.com/base/path"), "https://github.example.com/base/path/");
|
||||||
|
t.deepEqual(util.parseGithubUrl("https://github.example.com/base/path/api/v3"), "https://github.example.com/base/path/");
|
||||||
|
t.throws(() => util.parseGithubUrl(""), {
|
||||||
|
message: '"" is not a valid URL',
|
||||||
|
});
|
||||||
|
t.throws(() => util.parseGithubUrl("ssh://github.com"), {
|
||||||
|
message: '"ssh://github.com" is not a http or https URL',
|
||||||
|
});
|
||||||
|
t.throws(() => util.parseGithubUrl("http:///::::433"), {
|
||||||
|
message: '"http:///::::433" is not a valid URL',
|
||||||
|
});
|
||||||
|
});
|
||||||
//# sourceMappingURL=util.test.js.map
|
//# sourceMappingURL=util.test.js.map
|
||||||
File diff suppressed because one or more lines are too long
2
node_modules/.bin/uuid
generated
vendored
2
node_modules/.bin/uuid
generated
vendored
@@ -1 +1 @@
|
|||||||
../uuid/bin/uuid
|
../uuid/dist/bin/uuid
|
||||||
1
node_modules/.bin/which
generated
vendored
1
node_modules/.bin/which
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../which/bin/which
|
|
||||||
6
node_modules/windows-release/license → node_modules/@actions/core/LICENSE.md
generated
vendored
6
node_modules/windows-release/license → node_modules/@actions/core/LICENSE.md
generated
vendored
@@ -1,9 +1,9 @@
|
|||||||
MIT License
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
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:
|
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 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.
|
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.
|
||||||
9
node_modules/@actions/core/README.md
generated
vendored
9
node_modules/@actions/core/README.md
generated
vendored
@@ -82,7 +82,14 @@ try {
|
|||||||
core.warning('myInput was not set');
|
core.warning('myInput was not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
// curl -v https://github.com
|
||||||
|
} else {
|
||||||
|
// curl https://github.com
|
||||||
|
}
|
||||||
|
|
||||||
// Do stuff
|
// Do stuff
|
||||||
|
core.info('Output to the actions build log')
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
core.error(`Error ${err}, action may still succeed though`);
|
||||||
@@ -137,4 +144,4 @@ const core = require('@actions/core');
|
|||||||
var pid = core.getState("pidToKill");
|
var pid = core.getState("pidToKill");
|
||||||
|
|
||||||
process.kill(pid);
|
process.kill(pid);
|
||||||
```
|
```
|
||||||
|
|||||||
10
node_modules/@actions/core/lib/command.d.ts
generated
vendored
10
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@@ -1,16 +1,16 @@
|
|||||||
interface CommandProperties {
|
interface CommandProperties {
|
||||||
[key: string]: string;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ::name key=value,key=value::message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ::warning::This is the message
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
* ::set-env name=MY_VAR::some value
|
||||||
*/
|
*/
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||||
export declare function issue(name: string, message?: string): void;
|
export declare function issue(name: string, message?: string): void;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
47
node_modules/@actions/core/lib/command.js
generated
vendored
47
node_modules/@actions/core/lib/command.js
generated
vendored
@@ -1,15 +1,23 @@
|
|||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = require("os");
|
const os = __importStar(require("os"));
|
||||||
|
const utils_1 = require("./utils");
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ::name key=value,key=value::message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ::warning::This is the message
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
* ::set-env name=MY_VAR::some value
|
||||||
*/
|
*/
|
||||||
function issueCommand(command, properties, message) {
|
function issueCommand(command, properties, message) {
|
||||||
const cmd = new Command(command, properties, message);
|
const cmd = new Command(command, properties, message);
|
||||||
@@ -34,33 +42,38 @@ class Command {
|
|||||||
let cmdStr = CMD_STRING + this.command;
|
let cmdStr = CMD_STRING + this.command;
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||||
cmdStr += ' ';
|
cmdStr += ' ';
|
||||||
|
let first = true;
|
||||||
for (const key in this.properties) {
|
for (const key in this.properties) {
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
if (this.properties.hasOwnProperty(key)) {
|
||||||
const val = this.properties[key];
|
const val = this.properties[key];
|
||||||
if (val) {
|
if (val) {
|
||||||
// safely append the val - avoid blowing up when attempting to
|
if (first) {
|
||||||
// call .replace() if message is not a string for some reason
|
first = false;
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)},`;
|
}
|
||||||
|
else {
|
||||||
|
cmdStr += ',';
|
||||||
|
}
|
||||||
|
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmdStr += CMD_STRING;
|
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||||
// safely append the message - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
const message = `${this.message || ''}`;
|
|
||||||
cmdStr += escapeData(message);
|
|
||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
return utils_1.toCommandValue(s)
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escape(s) {
|
function escapeProperty(s) {
|
||||||
return s
|
return utils_1.toCommandValue(s)
|
||||||
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
.replace(/]/g, '%5D')
|
.replace(/:/g, '%3A')
|
||||||
.replace(/;/g, '%3B');
|
.replace(/,/g, '%2C');
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=command.js.map
|
//# sourceMappingURL=command.js.map
|
||||||
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAA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pB,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"}
|
||||||
32
node_modules/@actions/core/lib/core.d.ts
generated
vendored
32
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -21,9 +21,9 @@ export declare enum ExitCode {
|
|||||||
/**
|
/**
|
||||||
* Sets env variable for this action and future actions in the job
|
* Sets env variable for this action and future actions in the job
|
||||||
* @param name the name of the variable to set
|
* @param name the name of the variable to set
|
||||||
* @param val the value of the variable
|
* @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: string): void;
|
export declare function exportVariable(name: string, val: any): void;
|
||||||
/**
|
/**
|
||||||
* Registers a secret which will get masked from logs
|
* Registers a secret which will get masked from logs
|
||||||
* @param secret value of the secret
|
* @param secret value of the secret
|
||||||
@@ -46,15 +46,25 @@ export declare function getInput(name: string, options?: InputOptions): string;
|
|||||||
* Sets the value of an output.
|
* Sets the value of an output.
|
||||||
*
|
*
|
||||||
* @param name name of the output to set
|
* @param name name of the output to set
|
||||||
* @param value value to store
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||||
*/
|
*/
|
||||||
export declare function setOutput(name: string, value: string): void;
|
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.
|
* Sets the action status to failed.
|
||||||
* When the action exits it will be with an exit code of 1
|
* When the action exits it will be with an exit code of 1
|
||||||
* @param message add error issue message
|
* @param message add error issue message
|
||||||
*/
|
*/
|
||||||
export declare function setFailed(message: string): void;
|
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
|
* Writes debug message to user log
|
||||||
* @param message debug message
|
* @param message debug message
|
||||||
@@ -62,14 +72,14 @@ export declare function setFailed(message: string): void;
|
|||||||
export declare function debug(message: string): void;
|
export declare function debug(message: string): void;
|
||||||
/**
|
/**
|
||||||
* Adds an error issue
|
* Adds an error issue
|
||||||
* @param message error issue message
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
*/
|
*/
|
||||||
export declare function error(message: string): void;
|
export declare function error(message: string | Error): void;
|
||||||
/**
|
/**
|
||||||
* Adds an warning issue
|
* Adds an warning issue
|
||||||
* @param message warning issue message
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
*/
|
*/
|
||||||
export declare function warning(message: string): void;
|
export declare function warning(message: string | Error): void;
|
||||||
/**
|
/**
|
||||||
* Writes info to log with console.log.
|
* Writes info to log with console.log.
|
||||||
* @param message info message
|
* @param message info message
|
||||||
@@ -100,9 +110,9 @@ 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.
|
* 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 name name of the state to store
|
||||||
* @param value value 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: string): void;
|
export declare function saveState(name: string, value: any): void;
|
||||||
/**
|
/**
|
||||||
* Gets the value of an state set by this action's main execution.
|
* Gets the value of an state set by this action's main execution.
|
||||||
*
|
*
|
||||||
|
|||||||
67
node_modules/@actions/core/lib/core.js
generated
vendored
67
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -8,10 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = require("./command");
|
const command_1 = require("./command");
|
||||||
const os = require("os");
|
const file_command_1 = require("./file-command");
|
||||||
const path = require("path");
|
const utils_1 = require("./utils");
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
*/
|
*/
|
||||||
@@ -32,11 +41,21 @@ var ExitCode;
|
|||||||
/**
|
/**
|
||||||
* Sets env variable for this action and future actions in the job
|
* Sets env variable for this action and future actions in the job
|
||||||
* @param name the name of the variable to set
|
* @param name the name of the variable to set
|
||||||
* @param val the value of the variable
|
* @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) {
|
function exportVariable(name, val) {
|
||||||
process.env[name] = val;
|
const convertedVal = utils_1.toCommandValue(val);
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
process.env[name] = convertedVal;
|
||||||
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||||
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||||
|
file_command_1.issueCommand('ENV', commandValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +71,13 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
file_command_1.issueCommand('PATH', inputPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
|
}
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
@@ -75,12 +100,22 @@ exports.getInput = getInput;
|
|||||||
* Sets the value of an output.
|
* Sets the value of an output.
|
||||||
*
|
*
|
||||||
* @param name name of the output to set
|
* @param name name of the output to set
|
||||||
* @param value value 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 setOutput(name, value) {
|
function setOutput(name, value) {
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
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
|
// Results
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@@ -97,6 +132,13 @@ exports.setFailed = setFailed;
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Logging Commands
|
// 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
|
* Writes debug message to user log
|
||||||
* @param message debug message
|
* @param message debug message
|
||||||
@@ -107,18 +149,18 @@ function debug(message) {
|
|||||||
exports.debug = debug;
|
exports.debug = debug;
|
||||||
/**
|
/**
|
||||||
* Adds an error issue
|
* Adds an error issue
|
||||||
* @param message error issue message
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
*/
|
*/
|
||||||
function error(message) {
|
function error(message) {
|
||||||
command_1.issue('error', message);
|
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
exports.error = error;
|
exports.error = error;
|
||||||
/**
|
/**
|
||||||
* Adds an warning issue
|
* Adds an warning issue
|
||||||
* @param message warning issue message
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
*/
|
*/
|
||||||
function warning(message) {
|
function warning(message) {
|
||||||
command_1.issue('warning', message);
|
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
exports.warning = warning;
|
exports.warning = warning;
|
||||||
/**
|
/**
|
||||||
@@ -176,8 +218,9 @@ exports.group = group;
|
|||||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
* 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 name name of the state to store
|
||||||
* @param value value 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) {
|
function saveState(name, value) {
|
||||||
command_1.issueCommand('save-state', { name }, value);
|
command_1.issueCommand('save-state', { name }, value);
|
||||||
}
|
}
|
||||||
|
|||||||
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,yBAAwB;AACxB,6BAA4B;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,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;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,OA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O,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;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"}
|
||||||
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export declare function issueCommand(command: string, message: any): void;
|
||||||
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"use strict";
|
||||||
|
// For internal use, subject to change.
|
||||||
|
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 });
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const fs = __importStar(require("fs"));
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
function issueCommand(command, message) {
|
||||||
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
|
if (!filePath) {
|
||||||
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
throw new Error(`Missing file at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
//# sourceMappingURL=file-command.js.map
|
||||||
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
||||||
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use strict";
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,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"}
|
||||||
9
node_modules/@actions/core/package.json
generated
vendored
9
node_modules/@actions/core/package.json
generated
vendored
@@ -1,21 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"version": "1.2.0",
|
"version": "1.2.6",
|
||||||
"description": "Actions core lib",
|
"description": "Actions core lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
"actions",
|
"actions",
|
||||||
"core"
|
"core"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "lib/core.js",
|
"main": "lib/core.js",
|
||||||
|
"types": "lib/core.d.ts",
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib",
|
||||||
|
"!.DS_Store"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@@ -26,6 +28,7 @@
|
|||||||
"directory": "packages/core"
|
"directory": "packages/core"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
|
|||||||
31
node_modules/@actions/github/README.md
generated
vendored
31
node_modules/@actions/github/README.md
generated
vendored
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Returns an authenticated Octokit client that follows the machine [proxy settings](https://help.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners). See https://octokit.github.io/rest.js for the API.
|
Returns an authenticated Octokit client that follows the machine [proxy settings](https://help.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners) and correctly sets GHES base urls. See https://octokit.github.io/rest.js for the API.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
@@ -17,7 +17,10 @@ async function run() {
|
|||||||
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret
|
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret
|
||||||
const myToken = core.getInput('myToken');
|
const myToken = core.getInput('myToken');
|
||||||
|
|
||||||
const octokit = new github.GitHub(myToken);
|
const octokit = github.getOctokit(myToken)
|
||||||
|
|
||||||
|
// You can also pass in additional options as a second parameter to getOctokit
|
||||||
|
// const octokit = github.getOctokit(myToken, {userAgent: "MyActionVersion1"});
|
||||||
|
|
||||||
const { data: pullRequest } = await octokit.pulls.get({
|
const { data: pullRequest } = await octokit.pulls.get({
|
||||||
owner: 'octokit',
|
owner: 'octokit',
|
||||||
@@ -34,8 +37,6 @@ async function run() {
|
|||||||
run();
|
run();
|
||||||
```
|
```
|
||||||
|
|
||||||
You can pass client options, as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor.
|
|
||||||
|
|
||||||
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
|
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@@ -72,3 +73,25 @@ if (github.context.eventName === 'push') {
|
|||||||
core.info(`The head commit is: ${pushPayload.head}`)
|
core.info(`The head commit is: ${pushPayload.head}`)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Extending the Octokit instance
|
||||||
|
`@octokit/core` now supports the [plugin architecture](https://github.com/octokit/core.js#plugins). You can extend the GitHub instance using plugins.
|
||||||
|
|
||||||
|
For example, using the `@octokit/plugin-enterprise-server` you can now access enterprise admin apis on GHES instances.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { GitHub, getOctokitOptions } from '@actions/github/lib/utils'
|
||||||
|
import { enterpriseServer220Admin } from '@octokit/plugin-enterprise-server'
|
||||||
|
|
||||||
|
const octokit = GitHub.plugin(enterpriseServer220Admin)
|
||||||
|
// or override some of the default values as well
|
||||||
|
// const octokit = GitHub.plugin(enterpriseServer220Admin).defaults({userAgent: "MyNewUserAgent"})
|
||||||
|
|
||||||
|
const myToken = core.getInput('myToken');
|
||||||
|
const myOctokit = new octokit(getOctokitOptions(token))
|
||||||
|
// Create a new user
|
||||||
|
myOctokit.enterpriseAdmin.createUser({
|
||||||
|
login: "testuser",
|
||||||
|
email: "testuser@test.com",
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|||||||
3
node_modules/@actions/github/lib/context.d.ts
generated
vendored
3
node_modules/@actions/github/lib/context.d.ts
generated
vendored
@@ -10,6 +10,9 @@ export declare class Context {
|
|||||||
workflow: string;
|
workflow: string;
|
||||||
action: string;
|
action: string;
|
||||||
actor: string;
|
actor: string;
|
||||||
|
job: string;
|
||||||
|
runNumber: number;
|
||||||
|
runId: number;
|
||||||
/**
|
/**
|
||||||
* Hydrate the context from the environment
|
* Hydrate the context from the environment
|
||||||
*/
|
*/
|
||||||
|
|||||||
4
node_modules/@actions/github/lib/context.js
generated
vendored
4
node_modules/@actions/github/lib/context.js
generated
vendored
@@ -1,5 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Context = void 0;
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
const os_1 = require("os");
|
const os_1 = require("os");
|
||||||
class Context {
|
class Context {
|
||||||
@@ -23,6 +24,9 @@ class Context {
|
|||||||
this.workflow = process.env.GITHUB_WORKFLOW;
|
this.workflow = process.env.GITHUB_WORKFLOW;
|
||||||
this.action = process.env.GITHUB_ACTION;
|
this.action = process.env.GITHUB_ACTION;
|
||||||
this.actor = process.env.GITHUB_ACTOR;
|
this.actor = process.env.GITHUB_ACTOR;
|
||||||
|
this.job = process.env.GITHUB_JOB;
|
||||||
|
this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
|
||||||
|
this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
|
||||||
}
|
}
|
||||||
get issue() {
|
get issue() {
|
||||||
const payload = this.payload;
|
const payload = this.payload;
|
||||||
|
|||||||
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAalB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,eAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,iBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;gBAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,kBAAkB,QAAG,EAAE,CAAC,CAAA;aACvE;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,I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CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AApED,0BAoEC"}
|
||||||
34
node_modules/@actions/github/lib/github.d.ts
generated
vendored
34
node_modules/@actions/github/lib/github.d.ts
generated
vendored
@@ -1,27 +1,11 @@
|
|||||||
import { graphql as GraphQL } from '@octokit/graphql/dist-types/types';
|
|
||||||
import { Octokit } from '@octokit/rest';
|
|
||||||
import * as Context from './context';
|
import * as Context from './context';
|
||||||
|
import { GitHub } from './utils';
|
||||||
|
import { OctokitOptions } from '@octokit/core/dist-types/types';
|
||||||
export declare const context: Context.Context;
|
export declare const context: Context.Context;
|
||||||
export declare class GitHub extends Octokit {
|
/**
|
||||||
graphql: GraphQL;
|
* Returns a hydrated octokit ready to use for GitHub Actions
|
||||||
/**
|
*
|
||||||
* Sets up the REST client and GraphQL client with auth and proxy support.
|
* @param token the repo PAT or GITHUB_TOKEN
|
||||||
* The parameter `token` or `opts.auth` must be supplied. The GraphQL client
|
* @param options other options to set
|
||||||
* authorization is not setup when `opts.auth` is a function or object.
|
*/
|
||||||
*
|
export declare function getOctokit(token: string, options?: OctokitOptions): InstanceType<typeof GitHub>;
|
||||||
* @param token Auth token
|
|
||||||
* @param opts Octokit options
|
|
||||||
*/
|
|
||||||
constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>);
|
|
||||||
constructor(opts: Octokit.Options);
|
|
||||||
/**
|
|
||||||
* Disambiguates the constructor overload parameters
|
|
||||||
*/
|
|
||||||
private static disambiguate;
|
|
||||||
private static getOctokitOptions;
|
|
||||||
private static getGraphQL;
|
|
||||||
private static getAuthString;
|
|
||||||
private static getProxyAgent;
|
|
||||||
private static getApiBaseUrl;
|
|
||||||
private static getGraphQLBaseUrl;
|
|
||||||
}
|
|
||||||
|
|||||||
122
node_modules/@actions/github/lib/github.js
generated
vendored
122
node_modules/@actions/github/lib/github.js
generated
vendored
@@ -1,108 +1,36 @@
|
|||||||
"use strict";
|
"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) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
result["default"] = mod;
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
|
exports.getOctokit = exports.context = void 0;
|
||||||
const graphql_1 = require("@octokit/graphql");
|
|
||||||
const rest_1 = require("@octokit/rest");
|
|
||||||
const Context = __importStar(require("./context"));
|
const Context = __importStar(require("./context"));
|
||||||
const httpClient = __importStar(require("@actions/http-client"));
|
const utils_1 = require("./utils");
|
||||||
// We need this in order to extend Octokit
|
|
||||||
rest_1.Octokit.prototype = new rest_1.Octokit();
|
|
||||||
exports.context = new Context.Context();
|
exports.context = new Context.Context();
|
||||||
class GitHub extends rest_1.Octokit {
|
/**
|
||||||
constructor(token, opts) {
|
* Returns a hydrated octokit ready to use for GitHub Actions
|
||||||
super(GitHub.getOctokitOptions(GitHub.disambiguate(token, opts)));
|
*
|
||||||
this.graphql = GitHub.getGraphQL(GitHub.disambiguate(token, opts));
|
* @param token the repo PAT or GITHUB_TOKEN
|
||||||
}
|
* @param options other options to set
|
||||||
/**
|
*/
|
||||||
* Disambiguates the constructor overload parameters
|
function getOctokit(token, options) {
|
||||||
*/
|
return new utils_1.GitHub(utils_1.getOctokitOptions(token, options));
|
||||||
static disambiguate(token, opts) {
|
|
||||||
return [
|
|
||||||
typeof token === 'string' ? token : '',
|
|
||||||
typeof token === 'object' ? token : opts || {}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
static getOctokitOptions(args) {
|
|
||||||
const token = args[0];
|
|
||||||
const options = Object.assign({}, args[1]); // Shallow clone - don't mutate the object provided by the caller
|
|
||||||
// Base URL - GHES or Dotcom
|
|
||||||
options.baseUrl = options.baseUrl || this.getApiBaseUrl();
|
|
||||||
// Auth
|
|
||||||
const auth = GitHub.getAuthString(token, options);
|
|
||||||
if (auth) {
|
|
||||||
options.auth = auth;
|
|
||||||
}
|
|
||||||
// Proxy
|
|
||||||
const agent = GitHub.getProxyAgent(options.baseUrl, options);
|
|
||||||
if (agent) {
|
|
||||||
// Shallow clone - don't mutate the object provided by the caller
|
|
||||||
options.request = options.request ? Object.assign({}, options.request) : {};
|
|
||||||
// Set the agent
|
|
||||||
options.request.agent = agent;
|
|
||||||
}
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
static getGraphQL(args) {
|
|
||||||
const defaults = {};
|
|
||||||
defaults.baseUrl = this.getGraphQLBaseUrl();
|
|
||||||
const token = args[0];
|
|
||||||
const options = args[1];
|
|
||||||
// Authorization
|
|
||||||
const auth = this.getAuthString(token, options);
|
|
||||||
if (auth) {
|
|
||||||
defaults.headers = {
|
|
||||||
authorization: auth
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// Proxy
|
|
||||||
const agent = GitHub.getProxyAgent(defaults.baseUrl, options);
|
|
||||||
if (agent) {
|
|
||||||
defaults.request = { agent };
|
|
||||||
}
|
|
||||||
return graphql_1.graphql.defaults(defaults);
|
|
||||||
}
|
|
||||||
static getAuthString(token, options) {
|
|
||||||
// Validate args
|
|
||||||
if (!token && !options.auth) {
|
|
||||||
throw new Error('Parameter token or opts.auth is required');
|
|
||||||
}
|
|
||||||
else if (token && options.auth) {
|
|
||||||
throw new Error('Parameters token and opts.auth may not both be specified');
|
|
||||||
}
|
|
||||||
return typeof options.auth === 'string' ? options.auth : `token ${token}`;
|
|
||||||
}
|
|
||||||
static getProxyAgent(destinationUrl, options) {
|
|
||||||
var _a;
|
|
||||||
if (!((_a = options.request) === null || _a === void 0 ? void 0 : _a.agent)) {
|
|
||||||
if (httpClient.getProxyUrl(destinationUrl)) {
|
|
||||||
const hc = new httpClient.HttpClient();
|
|
||||||
return hc.getAgent(destinationUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
static getApiBaseUrl() {
|
|
||||||
return process.env['GITHUB_API_URL'] || 'https://api.github.com';
|
|
||||||
}
|
|
||||||
static getGraphQLBaseUrl() {
|
|
||||||
let url = process.env['GITHUB_GRAPHQL_URL'] || 'https://api.github.com/graphql';
|
|
||||||
// Shouldn't be a trailing slash, but remove if so
|
|
||||||
if (url.endsWith('/')) {
|
|
||||||
url = url.substr(0, url.length - 1);
|
|
||||||
}
|
|
||||||
// Remove trailing "/graphql"
|
|
||||||
if (url.toUpperCase().endsWith('/GRAPHQL')) {
|
|
||||||
url = url.substr(0, url.length - '/graphql'.length);
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.GitHub = GitHub;
|
exports.getOctokit = getOctokit;
|
||||||
//# sourceMappingURL=github.js.map
|
//# sourceMappingURL=github.js.map
|
||||||
2
node_modules/@actions/github/lib/github.js.map
generated
vendored
2
node_modules/@actions/github/lib/github.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gGAAgG;AAChG,8CAAwC;AAUxC,wCAAqC;AACrC,mDAAoC;AAEpC,iEAAkD;AAElD,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAiBjC,YAAY,KAA+B,EAAE,IAAsB;QACjE,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAEjE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IACpE,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,YAAY,CACzB,KAA+B,EAC/B,IAAsB;QAEtB,OAAO;YACL,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACtC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,C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AI,GAAG,GACL,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,gCAAgC,CAAA;QAEvE,kDAAkD;QAClD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;SACpC;QAED,6BAA6B;QAC7B,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YAC1C,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;SACpD;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CACF;AAxID,wBAwIC"}
|
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,mCAAiD;AAKpC,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,KAAa,EACb,OAAwB;IAExB,OAAO,IAAI,cAAM,CAAC,yBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACtD,CAAC;AALD,gCAKC"}
|
||||||
4
node_modules/@actions/github/lib/interfaces.d.ts
generated
vendored
4
node_modules/@actions/github/lib/interfaces.d.ts
generated
vendored
@@ -33,4 +33,8 @@ export interface WebhookPayload {
|
|||||||
id: number;
|
id: number;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
comment?: {
|
||||||
|
id: number;
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
6
node_modules/@actions/github/lib/internal/utils.d.ts
generated
vendored
Normal file
6
node_modules/@actions/github/lib/internal/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import { OctokitOptions } from '@octokit/core/dist-types/types';
|
||||||
|
export declare function getAuthString(token: string, options: OctokitOptions): string | undefined;
|
||||||
|
export declare function getProxyAgent(destinationUrl: string): http.Agent;
|
||||||
|
export declare function getApiBaseUrl(): string;
|
||||||
43
node_modules/@actions/github/lib/internal/utils.js
generated
vendored
Normal file
43
node_modules/@actions/github/lib/internal/utils.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
"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 (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0;
|
||||||
|
const httpClient = __importStar(require("@actions/http-client"));
|
||||||
|
function getAuthString(token, options) {
|
||||||
|
if (!token && !options.auth) {
|
||||||
|
throw new Error('Parameter token or opts.auth is required');
|
||||||
|
}
|
||||||
|
else if (token && options.auth) {
|
||||||
|
throw new Error('Parameters token and opts.auth may not both be specified');
|
||||||
|
}
|
||||||
|
return typeof options.auth === 'string' ? options.auth : `token ${token}`;
|
||||||
|
}
|
||||||
|
exports.getAuthString = getAuthString;
|
||||||
|
function getProxyAgent(destinationUrl) {
|
||||||
|
const hc = new httpClient.HttpClient();
|
||||||
|
return hc.getAgent(destinationUrl);
|
||||||
|
}
|
||||||
|
exports.getProxyAgent = getProxyAgent;
|
||||||
|
function getApiBaseUrl() {
|
||||||
|
return process.env['GITHUB_API_URL'] || 'https://api.github.com';
|
||||||
|
}
|
||||||
|
exports.getApiBaseUrl = getApiBaseUrl;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
1
node_modules/@actions/github/lib/internal/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/github/lib/internal/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,iEAAkD;AAGlD,SAAgB,aAAa,CAC3B,KAAa,EACb,OAAuB;IAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;SAAM,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;KAC5E;IAED,OAAO,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAA;AAC3E,CAAC;AAXD,sCAWC;AAED,SAAgB,aAAa,CAAC,cAAsB;IAClD,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;IACtC,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AACpC,CAAC;AAHD,sCAGC;AAED,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,wBAAwB,CAAA;AAClE,CAAC;AAFD,sCAEC"}
|
||||||
21
node_modules/@actions/github/lib/utils.d.ts
generated
vendored
Normal file
21
node_modules/@actions/github/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import * as Context from './context';
|
||||||
|
import { Octokit } from '@octokit/core';
|
||||||
|
import { OctokitOptions } from '@octokit/core/dist-types/types';
|
||||||
|
export declare const context: Context.Context;
|
||||||
|
export declare const GitHub: (new (...args: any[]) => {
|
||||||
|
[x: string]: any;
|
||||||
|
}) & {
|
||||||
|
new (...args: any[]): {
|
||||||
|
[x: string]: any;
|
||||||
|
};
|
||||||
|
plugins: any[];
|
||||||
|
} & typeof Octokit & import("@octokit/core/dist-types/types").Constructor<import("@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types").RestEndpointMethods & {
|
||||||
|
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* Convience function to correctly format Octokit Options to pass into the constructor.
|
||||||
|
*
|
||||||
|
* @param token the repo PAT or GITHUB_TOKEN
|
||||||
|
* @param options other options to set
|
||||||
|
*/
|
||||||
|
export declare function getOctokitOptions(token: string, options?: OctokitOptions): OctokitOptions;
|
||||||
54
node_modules/@actions/github/lib/utils.js
generated
vendored
Normal file
54
node_modules/@actions/github/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
"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 (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.getOctokitOptions = exports.GitHub = exports.context = void 0;
|
||||||
|
const Context = __importStar(require("./context"));
|
||||||
|
const Utils = __importStar(require("./internal/utils"));
|
||||||
|
// octokit + plugins
|
||||||
|
const core_1 = require("@octokit/core");
|
||||||
|
const plugin_rest_endpoint_methods_1 = require("@octokit/plugin-rest-endpoint-methods");
|
||||||
|
const plugin_paginate_rest_1 = require("@octokit/plugin-paginate-rest");
|
||||||
|
exports.context = new Context.Context();
|
||||||
|
const baseUrl = Utils.getApiBaseUrl();
|
||||||
|
const defaults = {
|
||||||
|
baseUrl,
|
||||||
|
request: {
|
||||||
|
agent: Utils.getProxyAgent(baseUrl)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults);
|
||||||
|
/**
|
||||||
|
* Convience function to correctly format Octokit Options to pass into the constructor.
|
||||||
|
*
|
||||||
|
* @param token the repo PAT or GITHUB_TOKEN
|
||||||
|
* @param options other options to set
|
||||||
|
*/
|
||||||
|
function getOctokitOptions(token, options) {
|
||||||
|
const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
|
||||||
|
// Auth
|
||||||
|
const auth = Utils.getAuthString(token, opts);
|
||||||
|
if (auth) {
|
||||||
|
opts.auth = auth;
|
||||||
|
}
|
||||||
|
return opts;
|
||||||
|
}
|
||||||
|
exports.getOctokitOptions = getOctokitOptions;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
1
node_modules/@actions/github/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/github/lib/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,wDAAyC;AAEzC,oBAAoB;AACpB,wCAAqC;AAErC,wFAAyE;AACzE,wEAA0D;AAE7C,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;AACrC,MAAM,QAAQ,GAAG;IACf,OAAO;IACP,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;KACpC;CACF,CAAA;AAEY,QAAA,MAAM,GAAG,cAAO,CAAC,MAAM,CAClC,kDAAmB,EACnB,mCAAY,CACb,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAEpB;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,KAAa,EACb,OAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA,CAAC,iEAAiE;IAE/G,OAAO;IACP,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAbD,8CAaC"}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
* Some “list” response that can be paginated have a different response structure
|
|
||||||
*
|
|
||||||
* They have a `total_count` key in the response (search also has `incomplete_results`,
|
|
||||||
* /installation/repositories also has `repository_selection`), as well as a key with
|
|
||||||
* the list of the items which name varies from endpoint to endpoint:
|
|
||||||
*
|
|
||||||
* - https://developer.github.com/v3/search/#example (key `items`)
|
|
||||||
* - https://developer.github.com/v3/checks/runs/#response-3 (key: `check_runs`)
|
|
||||||
* - https://developer.github.com/v3/checks/suites/#response-1 (key: `check_suites`)
|
|
||||||
* - https://developer.github.com/v3/apps/installations/#list-repositories (key: `repositories`)
|
|
||||||
* - https://developer.github.com/v3/apps/installations/#list-installations-for-a-user (key `installations`)
|
|
||||||
*
|
|
||||||
* Octokit normalizes these responses so that paginated results are always returned following
|
|
||||||
* the same structure. One challenge is that if the list response has only one page, no Link
|
|
||||||
* header is provided, so this header alone is not sufficient to check wether a response is
|
|
||||||
* paginated or not. For the exceptions with the namespace, a fallback check for the route
|
|
||||||
* paths has to be added in order to normalize the response. We cannot check for the total_count
|
|
||||||
* property because it also exists in the response of Get the combined status for a specific ref.
|
|
||||||
*/
|
|
||||||
const REGEX = [
|
|
||||||
/^\/search\//,
|
|
||||||
/^\/repos\/[^/]+\/[^/]+\/commits\/[^/]+\/(check-runs|check-suites)([^/]|$)/,
|
|
||||||
/^\/installation\/repositories([^/]|$)/,
|
|
||||||
/^\/user\/installations([^/]|$)/,
|
|
||||||
/^\/repos\/[^/]+\/[^/]+\/actions\/secrets([^/]|$)/,
|
|
||||||
/^\/repos\/[^/]+\/[^/]+\/actions\/workflows(\/[^/]+\/runs)?([^/]|$)/,
|
|
||||||
/^\/repos\/[^/]+\/[^/]+\/actions\/runs(\/[^/]+\/(artifacts|jobs))?([^/]|$)/
|
|
||||||
];
|
|
||||||
export function normalizePaginatedListResponse(octokit, url, response) {
|
|
||||||
const path = url.replace(octokit.request.endpoint.DEFAULTS.baseUrl, "");
|
|
||||||
const responseNeedsNormalization = REGEX.find(regex => regex.test(path));
|
|
||||||
if (!responseNeedsNormalization)
|
|
||||||
return;
|
|
||||||
// keep the additional properties intact as there is currently no other way
|
|
||||||
// to retrieve the same information.
|
|
||||||
const incompleteResults = response.data.incomplete_results;
|
|
||||||
const repositorySelection = response.data.repository_selection;
|
|
||||||
const totalCount = response.data.total_count;
|
|
||||||
delete response.data.incomplete_results;
|
|
||||||
delete response.data.repository_selection;
|
|
||||||
delete response.data.total_count;
|
|
||||||
const namespaceKey = Object.keys(response.data)[0];
|
|
||||||
const data = response.data[namespaceKey];
|
|
||||||
response.data = data;
|
|
||||||
if (typeof incompleteResults !== "undefined") {
|
|
||||||
response.data.incomplete_results = incompleteResults;
|
|
||||||
}
|
|
||||||
if (typeof repositorySelection !== "undefined") {
|
|
||||||
response.data.repository_selection = repositorySelection;
|
|
||||||
}
|
|
||||||
response.data.total_count = totalCount;
|
|
||||||
Object.defineProperty(response.data, namespaceKey, {
|
|
||||||
get() {
|
|
||||||
octokit.log.warn(`[@octokit/paginate-rest] "response.data.${namespaceKey}" is deprecated for "GET ${path}". Get the results directly from "response.data"`);
|
|
||||||
return Array.from(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export const VERSION = "1.1.2";
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* Some “list” response that can be paginated have a different response structure
|
|
||||||
*
|
|
||||||
* They have a `total_count` key in the response (search also has `incomplete_results`,
|
|
||||||
* /installation/repositories also has `repository_selection`), as well as a key with
|
|
||||||
* the list of the items which name varies from endpoint to endpoint:
|
|
||||||
*
|
|
||||||
* - https://developer.github.com/v3/search/#example (key `items`)
|
|
||||||
* - https://developer.github.com/v3/checks/runs/#response-3 (key: `check_runs`)
|
|
||||||
* - https://developer.github.com/v3/checks/suites/#response-1 (key: `check_suites`)
|
|
||||||
* - https://developer.github.com/v3/apps/installations/#list-repositories (key: `repositories`)
|
|
||||||
* - https://developer.github.com/v3/apps/installations/#list-installations-for-a-user (key `installations`)
|
|
||||||
*
|
|
||||||
* Octokit normalizes these responses so that paginated results are always returned following
|
|
||||||
* the same structure. One challenge is that if the list response has only one page, no Link
|
|
||||||
* header is provided, so this header alone is not sufficient to check wether a response is
|
|
||||||
* paginated or not. For the exceptions with the namespace, a fallback check for the route
|
|
||||||
* paths has to be added in order to normalize the response. We cannot check for the total_count
|
|
||||||
* property because it also exists in the response of Get the combined status for a specific ref.
|
|
||||||
*/
|
|
||||||
import { Octokit } from "@octokit/core";
|
|
||||||
import { OctokitResponse } from "./types";
|
|
||||||
export declare function normalizePaginatedListResponse(octokit: Octokit, url: string, response: OctokitResponse<any>): void;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import { Octokit } from "@octokit/core";
|
|
||||||
import { MapFunction, PaginationResults, RequestParameters, Route } from "./types";
|
|
||||||
export declare function paginate(octokit: Octokit, route: Route, parameters?: RequestParameters, mapFn?: MapFunction): Promise<PaginationResults<any>>;
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
import * as OctokitTypes from "@octokit/types";
|
|
||||||
export { EndpointOptions } from "@octokit/types";
|
|
||||||
export { OctokitResponse } from "@octokit/types";
|
|
||||||
export { RequestParameters } from "@octokit/types";
|
|
||||||
export { Route } from "@octokit/types";
|
|
||||||
export interface PaginateInterface {
|
|
||||||
/**
|
|
||||||
* Sends a request based on endpoint options
|
|
||||||
*
|
|
||||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
|
||||||
* @param {function} mapFn Optional method to map each response to a custom array
|
|
||||||
*/
|
|
||||||
<T, R>(options: OctokitTypes.EndpointOptions, mapFn: MapFunction<T, R>): Promise<PaginationResults<R>>;
|
|
||||||
/**
|
|
||||||
* Sends a request based on endpoint options
|
|
||||||
*
|
|
||||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
|
||||||
*/
|
|
||||||
<T>(options: OctokitTypes.EndpointOptions): Promise<PaginationResults<T>>;
|
|
||||||
/**
|
|
||||||
* Sends a request based on endpoint options
|
|
||||||
*
|
|
||||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
|
||||||
* @param {function} mapFn Optional method to map each response to a custom array
|
|
||||||
*/
|
|
||||||
<T, R>(route: OctokitTypes.Route, mapFn: MapFunction<T>): Promise<PaginationResults<R>>;
|
|
||||||
/**
|
|
||||||
* Sends a request based on endpoint options
|
|
||||||
*
|
|
||||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
|
||||||
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
|
||||||
* @param {function} mapFn Optional method to map each response to a custom array
|
|
||||||
*/
|
|
||||||
<T, R>(route: OctokitTypes.Route, parameters: OctokitTypes.RequestParameters, mapFn: MapFunction<T>): Promise<PaginationResults<R>>;
|
|
||||||
/**
|
|
||||||
* Sends a request based on endpoint options
|
|
||||||
*
|
|
||||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
|
||||||
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
|
||||||
*/
|
|
||||||
<T>(route: OctokitTypes.Route, parameters: OctokitTypes.RequestParameters): Promise<PaginationResults<T>>;
|
|
||||||
/**
|
|
||||||
* Sends a request based on endpoint options
|
|
||||||
*
|
|
||||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
|
||||||
*/
|
|
||||||
<T>(route: OctokitTypes.Route): Promise<PaginationResults<T>>;
|
|
||||||
iterator: {
|
|
||||||
/**
|
|
||||||
* Get an asynchronous iterator for use with `for await()`,
|
|
||||||
*
|
|
||||||
* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of
|
|
||||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
|
||||||
*/
|
|
||||||
<T>(EndpointOptions: OctokitTypes.EndpointOptions): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginationResults<T>>>;
|
|
||||||
/**
|
|
||||||
* Get an asynchronous iterator for use with `for await()`,
|
|
||||||
*
|
|
||||||
* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of
|
|
||||||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
|
|
||||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
|
||||||
*/
|
|
||||||
<T>(route: OctokitTypes.Route, parameters?: OctokitTypes.RequestParameters): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginationResults<T>>>;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export interface MapFunction<T = any, R = any> {
|
|
||||||
(response: OctokitTypes.OctokitResponse<PaginationResults<T>>, done: () => void): R[];
|
|
||||||
}
|
|
||||||
export declare type PaginationResults<T = any> = T[];
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user