[StepSecurity] Apply security best practices #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CodeQL CSharp" | ||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: ["main"] | ||
schedule: | ||
- cron: "0 0 * * 1" | ||
permissions: | ||
contents: read | ||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: ["csharp"] | ||
# CodeQL supports [ $supported-codeql-languages ] | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@928ff8c822d966a999092a6a35e32177899afb7c # v2.24.6 | ||
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. | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
with: 6.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore crossroads.sln --locked-mode | ||
- name: Build | ||
run: dotnet build crossroads.sln --no-restore --configuration Release | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@928ff8c822d966a999092a6a35e32177899afb7c # v2.24.6 | ||
with: | ||
category: "/language:${{matrix.language}}" |