Skip to content

Commit c88841d

Browse files
authored
ci(scan): Add codeQL scanning (golangci#1405)
This commit is to add codeQL scanning, which is newly introduced feature from github. The scan will be run per PR, and periodically as well. Signed-off-by: Tam Mach <[email protected]>
1 parent f63ad9e commit c88841d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/codeql.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
name: "CodeQL"
7+
8+
on:
9+
push:
10+
branches: [ master ]
11+
pull_request:
12+
# The branches below must be a subset of the branches above
13+
branches: [ master ]
14+
schedule:
15+
- cron: '0 17 * * 5'
16+
17+
jobs:
18+
analyze:
19+
name: Analyze
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
# Override automatic language detection by changing the below list
26+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27+
# TODO: Enable for javascript later
28+
language: [ 'go' ]
29+
# Learn more...
30+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v2
35+
with:
36+
# We must fetch at least the immediate parents so that if this is
37+
# a pull request then we can checkout the head.
38+
fetch-depth: 2
39+
40+
# If this run was triggered by a pull request event, then checkout
41+
# the head of the pull request instead of the merge commit.
42+
- run: git checkout HEAD^2
43+
if: ${{ github.event_name == 'pull_request' }}
44+
45+
# Initializes the CodeQL tools for scanning.
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@v1
48+
with:
49+
languages: ${{ matrix.language }}
50+
# If you wish to specify custom queries, you can do so here or in a config file.
51+
# By default, queries listed here will override any specified in a config file.
52+
# Prefix the list here with "+" to use these queries and those in the config file.
53+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
54+
55+
# Use manual build instead of auto build
56+
- run: make build test
57+
58+
- name: Perform CodeQL Analysis
59+
uses: github/codeql-action/analyze@v1

0 commit comments

Comments
 (0)