Skip to content

chore(release): v6.2.4 #161

chore(release): v6.2.4

chore(release): v6.2.4 #161

Workflow file for this run

# SPDX-License-Identifier: Apache-2.0
name: CodeQL
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: "17 7 * * 1"
workflow_dispatch:
permissions:
actions: read
contents: read
pull-requests: read
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect CodeQL C/C++ scope
runs-on: ubuntu-latest
outputs:
cpp: ${{ steps.scope.outputs.cpp }}
paths: ${{ steps.scope.outputs.paths }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: scope
env:
GITHUB_BASE_REF: ${{ github.base_ref || 'main' }}
run: |
set -euo pipefail
if [[ "$GITHUB_EVENT_NAME" != "pull_request" ]]; then
{
echo "cpp=true"
echo "paths<<EOF"
echo "."
echo "EOF"
} >> "$GITHUB_OUTPUT"
exit 0
fi
if ! git rev-parse --verify --quiet "origin/$GITHUB_BASE_REF" >/dev/null; then
git fetch --no-tags --depth=1 origin "$GITHUB_BASE_REF"
fi
tmp_paths="$(mktemp)"
cpp=false
while IFS= read -r file; do
case "$file" in
*.c|*.cc|*.cpp|*.cxx|*.h|*.hh|*.hpp|*.hxx|*.ipp|*.tcc)
cpp=true
dir="$(dirname "$file")"
if [[ "$dir" == "." ]]; then
echo "." >> "$tmp_paths"
else
echo "$dir" >> "$tmp_paths"
fi
;;
esac
done < <(git diff --name-only --diff-filter=ACMR "origin/$GITHUB_BASE_REF"...HEAD)
{
echo "cpp=$cpp"
echo "paths<<EOF"
sort -u "$tmp_paths"
echo "EOF"
} >> "$GITHUB_OUTPUT"
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
language: [actions, python, rust]
steps:
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
- name: Autobuild Rust
if: matrix.language == 'rust'
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
analyze-cpp:
name: Analyze (c-cpp)
needs: changes
if: github.event_name != 'pull_request' || needs.changes.outputs.cpp == 'true'
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: Write C/C++ scope
env:
CODEQL_CPP_PATHS: ${{ needs.changes.outputs.paths }}
run: |
set -euo pipefail
mkdir -p .github/codeql
{
echo 'paths:'
while IFS= read -r path; do
if [[ -n "$path" ]]; then
printf ' - "%s"\n' "${path//\"/\\\"}"
fi
done <<< "$CODEQL_CPP_PATHS"
} > .github/codeql/cpp-scope.yml
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: c-cpp
build-mode: none
config-file: ./.github/codeql/cpp-scope.yml
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:c-cpp"