Skip to content

Commit f13bd45

Browse files
author
Simon Engledew
authored
Merge pull request #291 from github/simon-engledew/output-codeql-path
Add a codeql-path output to the init action
2 parents 0ed3207 + f761241 commit f13bd45

File tree

6 files changed

+13
-3
lines changed

6 files changed

+13
-3
lines changed

.github/workflows/codeql.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- uses: ./init
18+
id: init
1819
with:
1920
languages: javascript
2021
config-file: ./.github/codeql/codeql-config.yml
22+
# confirm steps.init.outputs.codeql-path points to the codeql binary
23+
- name: Print CodeQL Version
24+
run: ${{steps.init.outputs.codeql-path}} version --format=json
2125
- uses: ./analyze

.github/workflows/python-deps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444

4545
- name: Initialize CodeQL
4646
uses: ./init
47+
id: init
4748
with:
4849
tools: latest
4950
languages: python
@@ -62,8 +63,7 @@ jobs:
6263
esac
6364
echo ${basePath}
6465
65-
codeql_version="0.0.0-$(cat "$GITHUB_WORKSPACE/src/defaults.json" | jq -r .bundleVersion | rev | cut -d - -f 1 | rev)"
66-
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "${basePath}/hostedtoolcache/CodeQL/$codeql_version/x64/codeql"
66+
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})"
6767
- name: Setup for extractor
6868
run: |
6969
echo $CODEQL_PYTHON

init/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ inputs:
2323
description: Try to auto-install your python dependencies
2424
required: true
2525
default: 'true'
26+
outputs:
27+
codeql-path:
28+
description: The path of the CodeQL binary used for analysis
2629
runs:
2730
using: 'node12'
2831
main: '../lib/init-action.js'

lib/init-action.js

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

lib/init-action.js.map

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

src/init-action.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ async function run() {
176176
);
177177
}
178178
}
179+
180+
core.setOutput("codeql-path", config.codeQLCmd);
179181
} catch (error) {
180182
core.setFailed(error.message);
181183
console.log(error);

0 commit comments

Comments
 (0)