Skip to content

Commit fb21b13

Browse files
update workflow files to split codeql analysis for push and PR (#1273)
* update workflow files to split codeql analysis for push and PR * test changing a file * remove build all option in script for testing. * Revert "remove build all option in script for testing." This reverts commit 04eb2c3. * Revert "test changing a file" This reverts commit d692051. * combine pr and push analysis files to remove warning about not having on.push trigger. include script changes and file change for testing * remove test changes
1 parent cc8c103 commit fb21b13

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

.github/workflows/Code-Scanning.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ on:
2424
workflow_dispatch:
2525

2626
jobs:
27-
analyze:
28-
name: Analysis
27+
analyze-push:
28+
name: Analysis-Push
29+
if: github.event_name == 'push'
2930
runs-on: windows-latest
3031
permissions:
3132
actions: read
@@ -62,3 +63,46 @@ jobs:
6263
uses: github/codeql-action/analyze@v3
6364
with:
6465
category: "/language:${{matrix.language}}"
66+
analyze-pr:
67+
name: Analysis-PR
68+
if: github.event_name == 'pull_request'
69+
runs-on: windows-latest
70+
permissions:
71+
actions: read
72+
contents: read
73+
security-events: write
74+
75+
strategy:
76+
fail-fast: false
77+
matrix:
78+
include:
79+
- language: c-cpp
80+
build-mode: manual
81+
82+
steps:
83+
- name: Checkout repository
84+
uses: actions/checkout@v4
85+
with:
86+
submodules: 'recursive'
87+
- name: Install Nuget Packages
88+
run: nuget restore .\packages.config -PackagesDirectory .\packages\
89+
- name: Get changed files
90+
id: get-changed-files
91+
uses: tj-actions/changed-files@v41
92+
with:
93+
separator: ","
94+
- name: Initialize CodeQL
95+
uses: github/codeql-action/init@v3
96+
with:
97+
languages: ${{ matrix.language }}
98+
build-mode: ${{ matrix.build-mode }}
99+
config-file: microsoft/Windows-Driver-Developer-Supplemental-Tools/config/codeql-config.yml@development
100+
packs: +microsoft/windows-drivers@1.2.0-beta
101+
- if: matrix.build-mode == 'manual'
102+
run: |
103+
$changedFiles = "${{ steps.get-changed-files.outputs.all_changed_files }}".Split(',')
104+
.\.github\scripts\Build-ChangedSamples.ps1 -ChangedFiles $changedFiles -Verbose
105+
- name: Perform CodeQL analysis
106+
uses: github/codeql-action/analyze@v3
107+
with:
108+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)