reusable-workflows/.github/workflows/codeql-analysis.yml
2022-11-29 15:51:17 +01:00

58 lines
1.7 KiB
YAML

# This workflow helps to analize repository code for vulnerabilities, bugs, and other errors using CodeQL.
# For that CodeQL Action is used: https://github.com/github/codeql-action
# Learn more about CodeQL at https://codeql.github.com/
name: CodeQL
on:
workflow_call:
inputs:
codeql-cfg-path:
description: "Optional input to set path to the CodeQL config file"
required: false
type: string
build-command:
description: "Optional input to specify manual build command. Multiline syntax is supported"
required: false
type: string
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
if: ${{!inputs.codeql-cfg-path}}
uses: github/codeql-action/init@v2
- name: Initialize CodeQL with config file
if: ${{inputs.codeql-cfg-path}}
uses: github/codeql-action/init@v2
with:
config-file: ${{inputs.codeql-cfg-path}}
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, configure a build command manually using build-command input. This command will be executed in the corresponding step.
- name: Autobuild
if: ${{!inputs.build-command}}
uses: github/codeql-action/autobuild@v2
- name: Manual build
if: ${{inputs.build-command}}
run: |
${{inputs.build-command}}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2