Add CodeQL analysis workflow - #4
Conversation
This workflow file sets up CodeQL analysis for the repository, specifying triggers for pushes and pull requests to the master branch, as well as a scheduled run. It defines a matrix of languages to analyze and includes steps for initializing CodeQL and performing the analysis.
Reviewer's GuideIntroduces an advanced CodeQL workflow for GitHub Actions and C# security analysis on master changes and a weekly schedule, using matrix-based setup and GitHub’s CodeQL actions to report findings. Sequence diagram for the CodeQL analysis workflowsequenceDiagram
participant GitHub
participant Workflow as CodeQL_Workflow
participant Runner
participant CodeQL
participant Security as Security_Events
GitHub->>Workflow: trigger push/pull_request on master
GitHub->>Workflow: trigger scheduled run
Workflow->>Runner: create analyze job per matrix.language
Runner->>Runner: actions/checkout@v7
Runner->>CodeQL: github/codeql-action/init@v4
CodeQL-->>Runner: initialize language database
Runner->>CodeQL: github/codeql-action/analyze@v4
CodeQL->>Security: upload analysis findings
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
The added workflow YAML has indentation issues that make it invalid and likely to fail to run as-is.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a GitHub Actions workflow to enable CodeQL code scanning for this repository, running on pushes/PRs to master and on a scheduled basis.
Changes:
- Introduces
.github/workflows/codeql.ymlto run CodeQL Advanced analysis. - Configures a language matrix (Actions + C#) and scheduled execution.
File summaries
| File | Description |
|---|---|
| .github/workflows/codeql.yml | Adds CodeQL workflow configuration (triggers, matrix languages, init/analyze steps). |
Review details
Suppressed comments (1)
.github/workflows/codeql.yml:60
- The
steps:section is not properly indented (the- name:entries must be nested understeps:), which will prevent the workflow from running. Also, the repo usesactions/checkout@v4elsewhere;@v7is likely invalid and should be aligned to the supported version.
steps:
- name: Checkout repository
uses: actions/checkout@v7
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/codeql.yml" line_range="60" />
<code_context>
+ # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+
+ # Add any setup steps before running the `github/codeql-action/init` action.
</code_context>
<issue_to_address>
**issue (bug_risk):** The workflow references unavailable action versions: `actions/checkout@v7` and `github/codeql-action/*@v4`. GitHub cannot resolve these action refs, so every analysis job fails before CodeQL results are produced.
**Suggested fix:** Use published, repository-supported action versions, preferably the same pinned `actions/checkout` and `github/codeql-action` revisions used by `analyze-reusable.yml`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and this adds a scheduled and pull-request security workflow that grants its third-party CodeQL and checkout actions permission to write security events and read packages. If misconfigured or compromised, it could produce misleading scan results or consume CI resources; reverting stops future runs, while past alerts or workflow runs may need cleanup.
Blocking findings: .github/workflows/codeql.yml:60
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This workflow file sets up CodeQL analysis for the repository, specifying triggers for pushes and pull requests to the master branch, as well as a scheduled run. It defines a matrix of languages to analyze and includes steps for initializing CodeQL and performing the analysis.
PR Summary
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerSummary by Sourcery
Enable scheduled and change-triggered CodeQL security scanning for the repository.
New Features:
CI: