...
1# Copyright 2023 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15name: "CodeQL"
16
17on:
18 push:
19 branches: [ "main" ]
20 pull_request:
21 branches: [ "main" ]
22 paths-ignore:
23 - '**/*.md'
24 - '**/*.txt'
25 pull_request_target:
26 types: [labeled]
27 paths-ignore:
28 - '**/*.md'
29 - '**/*.txt'
30
31# Declare default permissions as read only.
32permissions: read-all
33
34jobs:
35 analyze:
36 if: "${{ github.event.action != 'labeled' || github.event.label.name == 'tests: run' }}"
37 name: Analyze
38 runs-on: ubuntu-latest
39 permissions:
40 actions: read
41 contents: read
42 security-events: write
43
44 strategy:
45 fail-fast: false
46 matrix:
47 language: [ 'go' ]
48
49 steps:
50 - name: Checkout repository
51 uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
52 with:
53 ref: ${{ github.event.pull_request.head.sha }}
54 repository: ${{ github.event.pull_request.head.repo.full_name }}
55
56 - name: Setup Go
57 uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
58 with:
59 go-version: "1.22"
60 if: ${{ matrix.language == 'go' }}
61
62 # Initializes the CodeQL tools for scanning.
63 - name: Initialize CodeQL
64 uses: github/codeql-action/init@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
65 with:
66 languages: ${{ matrix.language }}
67
68 # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
69 # If this step fails, then you should remove it and run the build manually
70 - name: Autobuild
71 uses: github/codeql-action/autobuild@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
72
73 - name: Perform CodeQL Analysis
74 uses: github/codeql-action/analyze@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
75 with:
76 category: "/language:${{matrix.language}}"
View as plain text