Skip to content

Commit a93f2e0

Browse files
authored
Update CodeQL workflow (#308)
1 parent 47c9585 commit a93f2e0

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CodeQL"
1+
name: CodeQL
22

33
on:
44
push:
@@ -23,55 +23,49 @@ jobs:
2323
name: Analyze
2424
runs-on: ubuntu-22.04
2525
permissions:
26-
actions: read
27-
contents: read
28-
security-events: write
26+
actions: read # for github/codeql-action/init to get workflow details
27+
contents: read # for actions/checkout to fetch code
28+
security-events: write # for github/codeql-action/autobuild to send a status report
29+
packages: read # required to fetch internal or private CodeQL packs
2930

3031
strategy:
3132
fail-fast: false
3233
matrix:
33-
language: ["go"]
34-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
35-
# Use only 'java' to analyze code written in Java, Kotlin or both
36-
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
37-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
34+
include:
35+
- language: go
36+
build-mode: autobuild
37+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
38+
# Use `c-cpp` to analyze code written in C, C++ or both
39+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
40+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
41+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
42+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
43+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
44+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
3845

3946
steps:
4047
- name: Checkout repository
4148
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4249

50+
- name: Setup Golang Environment
51+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
52+
with:
53+
go-version: stable
54+
if: matrix.language == 'go'
55+
4356
# Initializes the CodeQL tools for scanning.
4457
- name: Initialize CodeQL
4558
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
4659
with:
4760
languages: ${{ matrix.language }}
61+
build-mode: ${{ matrix.build-mode }}
4862
# If you wish to specify custom queries, you can do so here or in a config file.
4963
# By default, queries listed here will override any specified in a config file.
5064
# Prefix the list here with "+" to use these queries and those in the config file.
5165

5266
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
5367
# queries: security-extended,security-and-quality
5468

55-
- name: Setup Golang Environment
56-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
57-
with:
58-
go-version: stable
59-
60-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
61-
# If this step fails, then you should remove it and run the build manually (see below)
62-
- name: Autobuild
63-
uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
64-
65-
# ℹ️ Command-line programs to run using the OS shell.
66-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
67-
68-
# If the Autobuild fails above, remove it and uncomment the following three lines.
69-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
70-
71-
# - run: |
72-
# echo "Run, Build Application using script"
73-
# ./location_of_script_within_repo/buildscript.sh
74-
7569
- name: Perform CodeQL Analysis
7670
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
7771
with:

0 commit comments

Comments
 (0)