-
-
Notifications
You must be signed in to change notification settings - Fork 473
64 lines (55 loc) · 1.77 KB
/
code-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Code analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
pssa:
name: PSScriptAnalyzer
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v4
- name: PowerShell Module Cache
uses: potatoqualitee/[email protected]
with:
modules-to-cache: PSScriptAnalyzer, ConvertToSARIF:1.0.0
# Not using microsoft/[email protected] because we're missing psm1 in src + need to exclude generated ps1xml
- name: Run PSScriptAnalyzer
shell: pwsh
run: |
Import-Module ConvertToSARIF -Force
Get-ChildItem -Path ./src/ -Filter *.ps* -Recurse -File |
Where-Object { $_.Name -ne 'Sync-WithProfiler.ps1' } |
Invoke-ScriptAnalyzer -Settings ./.github/workflows/PSScriptAnalyzerSettings.psd1 |
ConvertTo-SARIF -FilePath results.sarif
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
# codeql:
# name: CodeQL C#
# runs-on: ubuntu-latest
# permissions:
# actions: read
# contents: read
# security-events: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v2
# with:
# languages: csharp
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2
# - name: Perform CodeQL Analysis
# uses: github/codeql-action/analyze@v2