recreate codeql.yml

This commit is contained in:
akallabeth 2024-04-11 09:59:18 +02:00
parent be9df8d62b
commit 2b7146575f

View File

@ -14,59 +14,70 @@ name: "CodeQL"
on: on:
workflow_dispatch: workflow_dispatch:
branches: [ master, stable* ] branches: [ master, stable* ]
pull_request_target: push:
branches: [ master, stable* ] branches: [ "master", "stable*" ]
pull_request:
permissions: branches: [ "master", "stable*" ]
contents: read schedule:
- cron: '41 2 * * 2'
jobs: jobs:
analyze: analyze:
name: Analyze (${{ matrix.language }})
# 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
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions: permissions:
# required for all workflows
security-events: write security-events: write
# only required for workflows in private repositories
actions: read actions: read
contents: read contents: read
name: Analyze
runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'cpp' ] include:
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - language: c-cpp
# Learn more: build-mode: manual
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# 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.
# 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
steps: steps:
- uses: suzuki-shunsuke/get-pr-action@v0.1.0 - name: Checkout repository
id: pr uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{steps.pr.outputs.merge_commit_sha}}
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file. # 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. # 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. # 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
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # 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
# If this step fails, then you should remove it and run the build manually (see below) # queries: security-extended,security-and-quality
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2
# 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.
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines run: |
# and modify them (or add more) to build your code if your project
# uses a compiled language
- run: |
sudo apt update sudo apt update
sudo apt install \ sudo apt install \
libxrandr-dev \ libxrandr-dev \
@ -127,3 +138,5 @@ jobs:
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"