Skip to content

Comments

Adding code changes to integrate codeQL tool into pipeline#769

Merged
laxmikanth-msft merged 4 commits intomainfrom
user/lmolugu/codeQLFix
Feb 18, 2026
Merged

Adding code changes to integrate codeQL tool into pipeline#769
laxmikanth-msft merged 4 commits intomainfrom
user/lmolugu/codeQLFix

Conversation

@laxmikanth-msft
Copy link
Contributor

@laxmikanth-msft laxmikanth-msft commented Feb 17, 2026

I've added code changes to add codeQL static tool into pipeline for WPF samples. This will run the codeQL static tool on the codebase and if there are any abnormal changes in your PR, it will show up in the codeQL analysis section.

Microsoft Reviewers: Open in CodeFlow

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow to run GitHub CodeQL analysis for the WPF samples repository, enabling automated security scanning on pushes, PRs, manual runs, and a weekly schedule.

Changes:

  • Introduces a new codeql.yml workflow that initializes and runs CodeQL for C# on windows-latest.
  • Restores and builds WPFSamples.sln prior to CodeQL analysis.
  • Configures workflow triggers for main / release/* and a weekly cron schedule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 43 to 45
nuget restore WPFSamples.sln
dotnet restore WPFSamples.sln

Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow runs both nuget restore and dotnet restore on the same solution. Since the repo doesn’t appear to use packages.config-based restores, this is likely redundant and increases CI time/complexity. Consider keeping only dotnet restore WPFSamples.sln (or document why both are required).

Suggested change
nuget restore WPFSamples.sln
dotnet restore WPFSamples.sln
dotnet restore WPFSamples.sln

Copilot uses AI. Check for mistakes.
dotnet restore WPFSamples.sln

- name: Build solution
run: dotnet build WPFSamples.sln --configuration Release --no-restore /p:Platform="Any CPU" /p:LangVersion=latest /p:TreatWarningsAsErrors=false
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build command forces /p:LangVersion=latest, which can change compilation semantics relative to the repo’s intended configuration and potentially introduce build failures that don’t exist in normal builds. Consider removing this override so CodeQL analyzes the code as it is normally compiled.

Suggested change
run: dotnet build WPFSamples.sln --configuration Release --no-restore /p:Platform="Any CPU" /p:LangVersion=latest /p:TreatWarningsAsErrors=false
run: dotnet build WPFSamples.sln --configuration Release --no-restore /p:Platform="Any CPU" /p:TreatWarningsAsErrors=false

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +37
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For supply-chain hardening, consider pinning third-party GitHub Actions to full commit SHAs instead of floating major tags (e.g., @v4). This reduces the risk of a compromised action release affecting the workflow.

Copilot uses AI. Check for mistakes.

- name: Build solution
run: dotnet build WPFSamples.sln --configuration Release --no-restore /p:Platform="Any CPU" /p:LangVersion=latest /p:TreatWarningsAsErrors=false
continue-on-error: true
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build step is marked continue-on-error: true, which can allow the workflow to succeed even when the solution fails to compile. For compiled-language CodeQL analysis this can result in an incomplete/empty database and misleading “successful” security scanning. Consider removing continue-on-error, or explicitly handling build failures (e.g., fail the job or gate analysis on a successful build).

Suggested change
continue-on-error: true

Copilot uses AI. Check for mistakes.
Copy link
Member

@pranav-gupta-msft pranav-gupta-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dipeshmsft
Copy link
Member

@laxmikanth-msft , how are we going to run this pipeline ? I am still new to this, just wanted to understand the process.

Copy link
Member

@dipeshmsft dipeshmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the comments I left, the current state does not cover all the samples in this repo.
We should also look at WPFSamples.Msbuild.sln, these are archaic and may not build but I guess in the main pipeline these get built, so I recommend adding this.

@laxmikanth-msft
Copy link
Contributor Author

@microsoft-github-policy-service agree

@laxmikanth-msft laxmikanth-msft merged commit a121d7d into main Feb 18, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants