SB CodeQL #1
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: | |
| paths: | |
| - 'session2/java/**' | |
| branches: [main] | |
| pull_request: | |
| paths: | |
| - 'session2/java/**' | |
| branches: [main] | |
| permissions: | |
| security-events: write | |
| contents: read | |
| jobs: | |
| analyze: | |
| name: CodeQL Analyze Java | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Enable Debug Mode | |
| run: | | |
| echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV | |
| echo "CODEQL_EXTRACTOR_JAVA_ROOT_CAUSE_ANALYSIS=true" >> $GITHUB_ENV | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: java | |
| config-file: .github/codeql/config.yml | |
| - name: Build with Maven | |
| run: | | |
| cd session2/java/UserApp | |
| mvn -B clean compile --no-transfer-progress | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 | |
| with: | |
| category: "/language:java" | |
| output: results | |
| - name: Debug Info | |
| run: | | |
| echo "Contents of .github/codeql:" | |
| ls -R .github/codeql/ | |
| echo "Maven build directory:" | |
| ls -R session2/java/UserApp/target/ | |
| - name: Upload SARIF | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codeql-results | |
| path: results/java.sarif | |
| retention-days: 5 |