Skip to content

Commit 700edee

Browse files
committed
feat(ci): Update Action to read and output CodeQL Version
1 parent 6ee35c2 commit 700edee

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/actions/install-codeql/action.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,28 @@ description: |
55
outputs:
66
codeql-cli-version:
77
description: "The version of the CodeQL CLI that was installed or retrieved from cache"
8-
value: ${{ steps.install-codeql.outputs.codeql-cli-version }}
8+
value: ${{ steps.codeql-version.outputs.codeql-cli-version }}
99

1010
runs:
1111
using: composite
1212
steps:
13+
- name: "CodeQL Version"
14+
id: codeql-version
15+
shell: bash
16+
run: |
17+
echo "Reading CodeQL CLI version from .codeqlversion file."
18+
CODEQL_CLI_VERSION=$(cat ./.codeqlversion)
19+
echo "CODEQL_CLI_VERSION=${CODEQL_CLI_VERSION}" >> $GITHUB_ENV
20+
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT
21+
1322
- name: Cache CodeQL
1423
id: cache-codeql
1524
uses: actions/cache@v4
1625
with:
1726
# A list of files, directories, and wildcard patterns to cache and restore
1827
path: ${{github.workspace}}/codeql_home
1928
# An explicit key for restoring and saving the cache
20-
key: codeql-home-${{ inputs.codeql-cli-version }}
29+
key: codeql-home-${{ steps.codeql-version.outputs.codeql-cli-version }}
2130

2231
- name: Install CodeQL
2332
id: install-codeql
@@ -26,11 +35,8 @@ runs:
2635
env:
2736
GITHUB_TOKEN: ${{ github.token }}
2837
CODEQL_HOME: ${{ github.workspace }}/codeql_home
38+
CODEQL_CLI_VERSION: ${{ steps.codeql-version.outputs.codeql-cli-version }}
2939
run: |
30-
set -e
31-
32-
echo "Reading CodeQL CLI version from .codeqlversion file."
33-
CODEQL_CLI_VERSION=$(cat ./.codeqlversion)
3440
echo "Installing CodeQL CLI v${CODEQL_CLI_VERSION}."
3541
3642
mkdir -p $CODEQL_HOME

0 commit comments

Comments
 (0)