Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codeqlversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.20.1
17 changes: 17 additions & 0 deletions .github/actions/install-codeql/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
codeql-cli-version:
description: |
The version of the CodeQL CLI to be downloaded.
outputs:
codeql-cli-version:
description: "The version of the CodeQL CLI that was installed or retrieved from cache"
value: ${{ steps.install-codeql.outputs.codeql-cli-version }}

runs:
using: composite
Expand All @@ -19,13 +23,25 @@ runs:
key: codeql-home-${{ inputs.codeql-cli-version }}

- name: Install CodeQL
id: 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. Checking for .codeqlversion file."
if [ ! -f ./.codeqlversion ]; then
echo "Error: .codeqlversion file not found. Please specify a CodeQL CLI version." >&2
exit 1
fi
echo "Reading CodeQL CLI version 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
Expand All @@ -38,6 +54,7 @@ runs:

popd
echo "Done."
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT

- name: Add CodeQL to the PATH
shell: bash
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ jobs:

- name: Setup CodeQL
if: steps.changes.outputs.src == 'true'
id: install-codeql
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Install Packs
if: steps.changes.outputs.src == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
CODEQL_CLI_VERSION: ${{ env.CODEQL_CLI_VERSION }}
CODEQL_CLI_VERSION: ${{ steps.install-codeql.outputs.codeql-cli-version }}
run: |
gh repo clone github/codeql -- -b codeql-cli-${CODEQL_CLI_VERSION} # to make stubs available for tests
codeql pack install "${{ matrix.language }}/lib"
Expand Down Expand Up @@ -247,5 +246,3 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
run: |
./.github/scripts/pr-configs.sh "${{ github.event.number }}"


4 changes: 0 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches: [main]
workflow_dispatch:

env:
CODEQL_CLI_VERSION: 2.20.1

jobs:
queries:
Expand Down Expand Up @@ -42,8 +40,6 @@ jobs:
- name: Setup CodeQL
if: steps.check_version.outputs.publish == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Publish codeql-LANG-queries (src) pack.
if: steps.check_version.outputs.publish == 'true'
Expand Down