Skip to content

CodeQL checks

CodeQL checks #1

# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL checks"
on:
workflow_dispatch:
push:
branches: ['**'] # run on all branches
paths-ignore:
- '**/*.cue'
- '**/*.json'
- '**/*.md'
- '**/*.txt'
- '**/*.yml'
- pkg/storage/unified/sql/db/dbimpl/db.go # Ignoring warnings on the whole file for now while inline comments is not supported in Go (https://github.com/github/codeql/issues/11427)
schedule:
- cron: '0 4 * * 6'
permissions:
security-events: write
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
continue-on-error: true # doesn't block PRs from being merged if this fails
if: github.repository == 'grafana/grafana'
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are listed here
# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed
language: ['actions', 'javascript', 'go']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
persist-credentials: false
- if: matrix.language == 'go'
name: Set go version
uses: actions/setup-go@19bb51245e9c80abacb2e91cc42b33fa478b8639
with:
go-version-file: go.mod
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- if: matrix.language == 'go'
name: Build go files
run: |
go mod verify
make build-go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3