Skip to content

Commit

Permalink
Create codeql.yml (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
Himasnhu-AT committed Jun 6, 2024
1 parent cec0720 commit 74adf67
Showing 1 changed file with 59 additions and 0 deletions.
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

0 comments on commit 74adf67

Please sign in to comment.