Repository navigation
feat: add repo_commits_total to the AI security-context schema #8485
Workflow file for this run
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: | |
| branches: ["main"] | |
| pull_request: | |
| # The branches below must be a subset of the branches above | |
| branches: ["main"] | |
| schedule: | |
| - cron: "0 0 * * 1" | |
| permissions: | |
| contents: read | |
| jobs: | |
| analyze: | |
| name: Analyze | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| id-token: write # required for SLSA provenance - https://docs.chainloop.dev/guides/slsa/ | |
| env: | |
| CHAINLOOP_WORKFLOW_NAME: "codeql" | |
| CHAINLOOP_PROJECT: "chainloop" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| language: ["go"] | |
| steps: | |
| - name: Install Chainloop | |
| if: ${{ github.event_name != 'pull_request' }} | |
| # The installer is pinned by digest, as in package_sandbox_kit.yaml. | |
| # If dl.chainloop.dev publishes a new installer, re-pin with: | |
| # curl -sfL https://dl.chainloop.dev/cli/install.sh | sha256sum | |
| env: | |
| INSTALLER_SHA256: 6ebcdb8edc6f22c92b6ac31a363f7d60da6e04c60c4fadda44169f18492ba46e | |
| run: | | |
| curl -sfL https://dl.chainloop.dev/cli/install.sh -o /tmp/chainloop-install.sh | |
| echo "${INSTALLER_SHA256} /tmp/chainloop-install.sh" | sha256sum -c - | |
| bash /tmp/chainloop-install.sh | |
| - name: Checkout repository | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| with: | |
| persist-credentials: false | |
| - name: Initialize Attestation | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| chainloop attestation init --org chainloop --workflow $CHAINLOOP_WORKFLOW_NAME --project $CHAINLOOP_PROJECT | |
| env: | |
| # Needed for commit signature verification: https://docs.chainloop.dev/concepts/attestations#commit-verification | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Go | |
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| # Initializes the CodeQL tools for scanning. | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8 | |
| with: | |
| languages: ${{ matrix.language }} | |
| # The alert suppression query marks the alerts that a `// codeql[<query-id>]` | |
| # comment covers with a SARIF suppressions field. The default queries still run. | |
| packs: codeql/go-queries:AlertSuppression.ql | |
| - name: Autobuild | |
| uses: github/codeql-action/autobuild@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8 | |
| - name: Perform CodeQL Analysis | |
| id: codeqlresults | |
| uses: github/codeql-action/analyze@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8 | |
| with: | |
| category: "/language:${{matrix.language}}" | |
| - name: Add Attestation (Sarif results) | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| chainloop attestation add --name sarif-results --value ${{steps.codeqlresults.outputs.sarif-output}}/go.sarif | |
| - name: Finish and Record Attestation | |
| if: ${{ success() && github.event_name != 'pull_request' }} | |
| run: | | |
| chainloop attestation status --full | |
| chainloop attestation push | |
| - name: Mark attestation as failed | |
| if: ${{ failure() && github.event_name != 'pull_request' }} | |
| run: | | |
| chainloop attestation reset | |
| - name: Mark attestation as cancelled | |
| if: ${{ cancelled() && github.event_name != 'pull_request' }} | |
| run: | | |
| chainloop attestation reset --trigger cancellation |