|
| 1 | +name: "CodeQL" |
| 2 | +run-name: ${{ github.event.inputs.code_scanning_run_name }} |
| 3 | +on: [push, pull_request, workflow_dispatch] |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +env: |
| 10 | + CODE_SCANNING_REF: ${{ github.event.inputs.code_scanning_ref }} |
| 11 | + CODE_SCANNING_BASE_BRANCH: ${{ github.event.inputs.code_scanning_base_branch }} |
| 12 | + CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH: ${{ github.event.inputs.code_scanning_is_analyzing_default_branch }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + analyze: |
| 16 | + name: Analyze (${{ matrix.language }}) |
| 17 | + runs-on: ${{ fromJSON(matrix.runner) }} |
| 18 | + permissions: |
| 19 | + actions: read |
| 20 | + contents: read |
| 21 | + packages: read |
| 22 | + security-events: write |
| 23 | + continue-on-error: false |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - language: actions |
| 29 | + category: /language:actions |
| 30 | + build-mode: none |
| 31 | + runner: '["ubuntu-22.04"]' |
| 32 | + - language: go |
| 33 | + category: /language:go |
| 34 | + build-mode: autobuild |
| 35 | + runner: '["ubuntu-22.04"]' |
| 36 | + steps: |
| 37 | + - name: Checkout repository |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Initialize CodeQL |
| 41 | + uses: github/codeql-action/init@v3 |
| 42 | + with: |
| 43 | + languages: ${{ matrix.language }} |
| 44 | + build-mode: ${{ matrix.build-mode }} |
| 45 | + dependency-caching: ${{ runner.environment == 'github-hosted' }} |
| 46 | + queries: "" # Default query suite |
| 47 | + packs: github/ccr-${{ matrix.language }}-queries |
| 48 | + config: | |
| 49 | + default-setup: |
| 50 | + org: |
| 51 | + model-packs: [ ${{ github.event.inputs.code_scanning_codeql_packs }} ] |
| 52 | + threat-models: [ ] |
| 53 | + - name: Setup proxy for registries |
| 54 | + id: proxy |
| 55 | + uses: github/codeql-action/start-proxy@v3 |
| 56 | + with: |
| 57 | + registries_credentials: ${{ secrets.GITHUB_REGISTRIES_PROXY }} |
| 58 | + language: ${{ matrix.language }} |
| 59 | + |
| 60 | + - name: Configure |
| 61 | + uses: github/codeql-action/resolve-environment@v3 |
| 62 | + id: resolve-environment |
| 63 | + with: |
| 64 | + language: ${{ matrix.language }} |
| 65 | + - name: Setup Go |
| 66 | + uses: actions/setup-go@v5 |
| 67 | + if: matrix.language == 'go' && fromJSON(steps.resolve-environment.outputs.environment).configuration.go.version |
| 68 | + with: |
| 69 | + go-version: ${{ fromJSON(steps.resolve-environment.outputs.environment).configuration.go.version }} |
| 70 | + cache: false |
| 71 | + |
| 72 | + - name: Autobuild |
| 73 | + uses: github/codeql-action/autobuild@v3 |
| 74 | + |
| 75 | + - name: Perform CodeQL Analysis |
| 76 | + uses: github/codeql-action/analyze@v3 |
| 77 | + env: |
| 78 | + CODEQL_PROXY_HOST: ${{ steps.proxy.outputs.proxy_host }} |
| 79 | + CODEQL_PROXY_PORT: ${{ steps.proxy.outputs.proxy_port }} |
| 80 | + CODEQL_PROXY_CA_CERTIFICATE: ${{ steps.proxy.outputs.proxy_ca_certificate }} |
| 81 | + with: |
| 82 | + category: ${{ matrix.category }} |
0 commit comments