| 1 |
# |
| 2 |
# Copyright 2021 The Sigstore Authors. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
# you may not use this file except in compliance with the License. |
| 6 |
# You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
name: CodeQL |
| 17 |
on: |
| 18 |
push: |
| 19 |
branches: |
| 20 |
- main |
| 21 |
pull_request: |
| 22 |
# The branches below must be a subset of the branches above |
| 23 |
branches: |
| 24 |
- main |
| 25 |
|
| 26 |
permissions: {} |
| 27 |
|
| 28 |
jobs: |
| 29 |
analyze: |
| 30 |
name: Analyze |
| 31 |
runs-on: ubuntu-latest |
| 32 |
|
| 33 |
permissions: |
| 34 |
contents: read |
| 35 |
security-events: write |
| 36 |
|
| 37 |
strategy: |
| 38 |
fail-fast: false |
| 39 |
matrix: |
| 40 |
language: |
| 41 |
- "go" |
| 42 |
steps: |
| 43 |
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 44 |
with: |
| 45 |
persist-credentials: false |
| 46 |
|
| 47 |
- name: Get Go version directive from go.mod as major.minor |
| 48 |
id: go_version |
| 49 |
run: | |
| 50 |
awk -F'[ .]' '/^go /{print "version=" $2 "." $3; exit}' go.mod >>"${GITHUB_OUTPUT}" |
| 51 |
|
| 52 |
- name: Set up Go |
| 53 |
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 |
| 54 |
with: |
| 55 |
go-version: "${{ steps.go_version.outputs.version }}" |
| 56 |
check-latest: true |
| 57 |
|
| 58 |
# Initializes the CodeQL tools for scanning. |
| 59 |
- name: Initialize CodeQL |
| 60 |
uses: github/codeql-action/init@99c9897648dded3fe63d6f328c46089dd57735ca # v2.17.0 |
| 61 |
with: |
| 62 |
languages: ${{ matrix.language }} |
| 63 |
build-mode: manual |
| 64 |
|
| 65 |
- name: build |
| 66 |
run: make pkg |
| 67 |
|
| 68 |
- name: Perform CodeQL Analysis |
| 69 |
uses: github/codeql-action/analyze@99c9897648dded3fe63d6f328c46089dd57735ca # v2.17.0 |
| 70 |
with: |
| 71 |
category: "/language:${{ matrix.language }}" |