2020-11-09 10:09:50 +00:00
# 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.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
2024-08-23 10:49:57 -04:00
name : "CodeQL Advanced"
2020-11-09 10:09:50 +00:00
on :
push :
branches : [ $default-branch, $protected-branches ]
pull_request :
2023-12-04 10:24:28 +01:00
branches : [ $default-branch, $protected-branches ]
2020-11-09 10:09:50 +00:00
schedule :
- cron : $cron-weekly
jobs :
analyze :
2024-03-26 13:18:17 +01:00
name : Analyze (${{ matrix.language }})
2023-07-13 09:36:51 -05:00
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
2024-04-03 10:23:11 +01:00
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
2023-04-17 12:06:44 -07:00
runs-on : ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2021-03-02 19:59:19 -06:00
permissions :
2024-01-09 12:22:16 -08:00
# required for all workflows
security-events : write
2024-04-11 09:39:30 +02:00
# required to fetch internal or private CodeQL packs
packages : read
2024-01-09 12:22:16 -08:00
# only required for workflows in private repositories
2021-04-23 14:06:00 -05:00
actions : read
2021-03-02 19:59:19 -06:00
contents : read
2020-11-09 10:09:50 +00:00
strategy :
fail-fast : false
matrix :
2024-02-15 09:01:39 +01:00
$codeql-languages-matrix
# CodeQL supports the following values keywords for 'language': $supported-codeql-languages
2024-02-19 15:54:06 +01:00
# Use `c-cpp` to analyze code written in C, C++ or both
2024-02-15 09:01:39 +01:00
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
2024-03-26 13:41:53 +01:00
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# 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
2020-11-09 10:09:50 +00:00
steps :
- name : Checkout repository
2023-12-14 12:21:29 +00:00
uses : actions/checkout@v4
2020-11-09 10:09:50 +00:00
2025-01-29 14:23:54 -08:00
# Add any setup steps before running the `github/codeql-action/init` action.
2025-01-29 15:39:32 -08:00
# This includes steps like installing compilers or runtimes (`actions/setup-node`
2025-01-29 14:23:54 -08:00
# or others). This is typically only required for manual builds.
2025-01-30 16:50:30 -08:00
# - name: Setup runtime (example)
# uses: actions/setup-example@v1
2025-01-29 14:23:54 -08:00
2020-11-09 10:09:50 +00:00
# Initializes the CodeQL tools for scanning.
- name : Initialize CodeQL
2025-10-07 10:11:06 -05:00
uses : github/codeql-action/init@v4
2020-11-09 10:09:50 +00:00
with :
languages : ${{ matrix.language }}
2024-02-15 09:01:39 +01:00
build-mode : ${{ matrix.build-mode }}
2020-11-09 10:09:50 +00:00
# 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.
2022-11-04 20:45:41 +01:00
2023-04-17 12:06:44 -07:00
# 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
2022-04-21 13:09:39 -04:00
# queries: security-extended,security-and-quality
2020-11-09 10:09:50 +00:00
2024-02-15 09:01:39 +01:00
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
2020-11-09 10:09:50 +00:00
# ℹ ️ Command-line programs to run using the OS shell.
2022-04-26 02:26:34 -07:00
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
2025-10-09 13:42:49 -05:00
- name : Run manual build steps
if : matrix.build-mode == 'manual'
2024-05-02 10:59:15 -04:00
shell : bash
2024-02-15 09:01:39 +01:00
run : |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
2020-11-09 10:09:50 +00:00
- name : Perform CodeQL Analysis
2025-10-07 10:11:06 -05:00
uses : github/codeql-action/analyze@v4
2022-09-16 09:25:07 +02:00
with :
category : "/language:${{matrix.language}}"