■ ■ ■ ■ ■ ■
.github/workflows/codeql.yml
| 1 | + | name: "CodeQL" |
| 2 | + | |
| 3 | + | on: |
| 4 | + | push: |
| 5 | + | branches: [ 'master' ] |
| 6 | + | pull_request: |
| 7 | + | # The branches below must be a subset of the branches above |
| 8 | + | branches: [ 'master' ] |
| 9 | + | schedule: |
| 10 | + | - cron: '30 11 * * 2' |
| 11 | + | |
| 12 | + | jobs: |
| 13 | + | analyze: |
| 14 | + | name: Analyze |
| 15 | + | runs-on: ubuntu-latest |
| 16 | + | permissions: |
| 17 | + | actions: read |
| 18 | + | contents: read |
| 19 | + | security-events: write |
| 20 | + | |
| 21 | + | strategy: |
| 22 | + | fail-fast: false |
| 23 | + | matrix: |
| 24 | + | language: [ 'java' ] |
| 25 | + | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] |
| 26 | + | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support |
| 27 | + | |
| 28 | + | steps: |
| 29 | + | - name: Checkout repository |
| 30 | + | uses: actions/checkout@v3 |
| 31 | + | |
| 32 | + | - name: Set up Java |
| 33 | + | uses: actions/setup-java@v2 |
| 34 | + | with: |
| 35 | + | distribution: adopt |
| 36 | + | java-version: '15' |
| 37 | + | |
| 38 | + | # Initializes the CodeQL tools for scanning. |
| 39 | + | - name: Initialize CodeQL |
| 40 | + | uses: github/codeql-action/init@v2 |
| 41 | + | with: |
| 42 | + | languages: ${{ matrix.language }} |
| 43 | + | # If you wish to specify custom queries, you can do so here or in a config file. |
| 44 | + | # By default, queries listed here will override any specified in a config file. |
| 45 | + | # Prefix the list here with "+" to use these queries and those in the config file. |
| 46 | + | |
| 47 | + | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs |
| 48 | + | queries: +security-and-quality |
| 49 | + | |
| 50 | + | |
| 51 | + | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). |
| 52 | + | # If this step fails, then you should remove it and run the build manually (see below) |
| 53 | + | - name: Autobuild |
| 54 | + | uses: github/codeql-action/autobuild@v2 |
| 55 | + | |
| 56 | + | # ℹ️ Command-line programs to run using the OS shell. |
| 57 | + | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 58 | + | |
| 59 | + | # If the Autobuild fails above, remove it and uncomment the following three lines. |
| 60 | + | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. |
| 61 | + | |
| 62 | + | # - run: | |
| 63 | + | # echo "Run, Build Application using script" |
| 64 | + | # ./location_of_script_within_repo/buildscript.sh |
| 65 | + | |
| 66 | + | - name: Perform CodeQL Analysis |
| 67 | + | uses: github/codeql-action/analyze@v2 |
| 68 | + | with: |
| 69 | + | category: "/language:${{matrix.language}}" |
| 70 | + | |