Merge pull request #10 from CoreyLeath-code/ops/enterprise-automation… #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | | |
| set -euo pipefail | |
| langs='' | |
| [ -n "$(find . -name '*.py' -print -quit)" ] && langs="$langs python" | |
| [ -n "$(find . -name '*.js' -print -quit)" ] || [ -n "$(find . -name '*.ts' -print -quit)" ] && 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" | |
| [ -n "$(find . -name '*.c' -print -quit)" ] || [ -n "$(find . -name '*.cpp' -print -quit)" ] && langs="$langs c-cpp" | |
| [ -n "$langs" ] || langs=' python' | |
| json="$(jq -cn --arg l "$langs" '$l | split(" ") | map(select(length > 0))')" | |
| echo "languages=$json" >> "$GITHUB_OUTPUT" | |
| 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 }} | |
| build-mode: none | |
| - uses: github/codeql-action/analyze@v3 |