Skip to content

ci: detect CodeQL languages per repository #7

ci: detect CodeQL languages per repository

ci: detect CodeQL languages per repository #7

Workflow file for this run

name: CodeQL
on:
push:
pull_request:
schedule:
- cron: '23 3 * * 1'
permissions:
contents: read
security-events: write
jobs:
detect:
runs-on: ubuntu-latest
outputs:
languages: ${{ steps.lang.outputs.languages }}
steps:
- uses: actions/checkout@v4
- id: lang
shell: bash
run: |
langs=''
find . -name '*.py' -print -quit | grep -q . && langs="$langs python"
find . ( -name '*.js' -o -name '*.ts' -o -name '*.tsx' ) -print -quit | grep -q . && langs="$langs javascript-typescript"
[ -f go.mod ] && langs="$langs go"
[ -f Cargo.toml ] && langs="$langs rust"
[ -f pom.xml ] || [ -f build.gradle ] && langs="$langs java-kotlin"
find . ( -name '*.c' -o -name '*.cpp' -o -name '*.h' ) -print -quit | grep -q . && langs="$langs c-cpp"
[ -n "$langs" ] || langs=' python'
langs="${langs# }"
echo "languages=$(printf '%s
' $langs | jq -Rsc 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"

Check failure on line 30 in .github/workflows/codeql.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/codeql.yml

Invalid workflow file

You have an error in your yaml syntax on line 30
analyze:
needs: detect
strategy:
fail-fast: false
matrix:
language: ${{ fromJSON(needs.detect.outputs.languages) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3