-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathaction.yml
More file actions
54 lines (47 loc) · 1.75 KB
/
action.yml
File metadata and controls
54 lines (47 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Setup CodeQL CLI
description: |
Install a CodeQL CLI or re-use an existing one from the cache and it to the path.
inputs:
codeql-cli-version:
description: |
The version of the CodeQL CLI to be downloaded.
runs:
using: composite
steps:
- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v4
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ${{github.workspace}}/codeql_home
# An explicit key for restoring and saving the cache
key: codeql-home-${{ inputs.codeql-cli-version }}
- name: Install CodeQL
if: steps.cache-codeql.outputs.cache-hit != 'true'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
CODEQL_HOME: ${{ github.workspace }}/codeql_home
CODEQL_CLI_VERSION: ${{ inputs.codeql-cli-version }}
run: |
if [ -z "$CODEQL_CLI_VERSION" ]; then
echo "No CodeQL CLI version specified. Reading from .codeqlversion file."
CODEQL_CLI_VERSION=$(cat ./.codeqlversion)
fi
echo "Installing CodeQL CLI v${CODEQL_CLI_VERSION}."
mkdir -p $CODEQL_HOME
echo "Change directory to $CODEQL_HOME"
pushd $CODEQL_HOME
echo "Downloading CodeQL CLI v${CODEQL_CLI_VERSION}."
gh release download "v${CODEQL_CLI_VERSION}" --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
echo "Unzipping CodeQL CLI."
unzip -q codeql-linux64.zip
popd
echo "Done."
- name: Add CodeQL to the PATH
shell: bash
env:
CODEQL_HOME: ${{ github.workspace }}/codeql_home
run: |
echo "Adding CodeQL CLI to the PATH."
echo "$CODEQL_HOME/codeql" >> $GITHUB_PATH