Skip to content

Commit 555e08a

Browse files
committed
Add action for CLI download.
1 parent bdcd304 commit 555e08a

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Setup CodeQL CLI
2+
description: |
3+
Install a CodeQL CLI or re-use an existing one from the cache and it to the path.
4+
inputs:
5+
codeql-cli-version:
6+
description: |
7+
The version of the CodeQL CLI to be downloaded.
8+
9+
runs:
10+
using: composite
11+
steps:
12+
# TODO: Consider to introduce caching for the CodeQL CLI.
13+
- name: Install CodeQL
14+
# if: steps.cache-codeql.outputs.cache-hit != 'true'
15+
shell: bash
16+
env:
17+
GITHUB_TOKEN: ${{ github.token }}
18+
CODEQL_HOME: ${{ github.workspace }}/codeql_home
19+
CODEQL_CLI_VERSION: ${{ inputs.codeql-cli-version }}
20+
run: |
21+
mkdir -p $CODEQL_HOME
22+
echo "Change directory to $CODEQL_HOME"
23+
pushd $CODEQL_HOME
24+
25+
echo "Downloading CodeQL CLI v${CODEQL_CLI_VERSION}."
26+
gh release download "v${CODEQL_CLI_VERSION}" --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
27+
28+
echo "Unzipping CodeQL CLI."
29+
unzip -q codeql-linux64.zip
30+
31+
popd
32+
33+
echo "Adding CodeQL CLI to the PATH."
34+
echo "$CODEQL_HOME/codeql" >> $GITHUB_PATH
35+
echo "Done."

.github/workflows/ci.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,11 @@ jobs:
2525
src:
2626
- '${{ matrix.language }}/**'
2727
28-
# TODO: Consider to introduce caching for the CodeQL CLI.
29-
- name: Install CodeQL
30-
shell: bash
31-
env:
32-
GITHUB_TOKEN: ${{ github.token }}
33-
CODEQL_HOME: ${{ github.workspace }}/codeql_home
34-
run: |
35-
mkdir -p $CODEQL_HOME
36-
echo "Change directory to $CODEQL_HOME"
37-
pushd $CODEQL_HOME
38-
39-
echo "Downloading CodeQL CLI"
40-
gh release download v2.19.2 --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
41-
42-
echo "Unzipping CodeQL CLI"
43-
unzip -q codeql-linux64.zip
44-
45-
popd
28+
- name: Setup CodeQL
29+
uses: ./.github/actions/install-codeql
30+
with:
31+
codeql-cli-version: 2.19.2
4632

47-
echo "Adding CodeQL CLI to PATH"
48-
echo "$CODEQL_HOME/codeql" >> $GITHUB_PATH
49-
5033
- name: Install Packs
5134
if: steps.changes.outputs.src == 'true'
5235
env:

0 commit comments

Comments
 (0)