Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create codeql.yml workflow #109

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all 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
59 changes: 59 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "CodeQL"

on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Find languages
id: findLanguages
run: |
countTS=$(find ./ -type f -name '*.ts' | wc -l)
countJS=$(find ./ -type f -name '*.js' | wc -l)
countPY=$(find ./ -type f -name '*.py' | wc -l)
countCPP=$(find ./ -type f -name '*.cpp' | wc -l)
countJAVA=$(find ./ -type f -name '*.java' | wc -l)
languages=""
if [ $countTS -gt 0 ]; then
languages+="typescript,"
fi
if [ $countJS -gt 0 ]; then
languages+="javascript,"
fi
if [ $countPY -gt 0 ]; then
languages+="python,"
fi
if [ $countCPP -gt 0 ]; then
languages+="cpp,"
fi
if [ $countJAVA -gt 0 ]; then
languages+="java,"
fi
# Remove the trailing comma
languages=${languages%,}
echo "languages=$languages" >> $GITHUB_ENV

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ env.languages }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2