ci: add CodeQL workflow for Python static analysis#2365
Conversation
Runs github/codeql-action with the default security-extended and security-and-quality query suites against the Python codebase on push to main, on PRs targeting main, and weekly so newly-published advisories get re-evaluated against the current source. build-mode: none — pr-agent is pure Python with no C extensions or custom build steps, so CodeQL's automatic source-only analysis is sufficient and faster than the build/autobuild path. Findings will surface under the repo's Security → Code scanning tab. Third-party actions pinned to commit SHAs (matches the policy already in publish.yml).
Review Summary by QodoAdd CodeQL workflow for Python static analysis
WalkthroughsDescription• Adds CodeQL workflow for automated Python security analysis • Runs on push to main, PRs, and weekly schedule • Uses security-extended and security-and-quality query suites • Pins third-party actions to commit SHAs for reproducibility Diagramflowchart LR
trigger["Push/PR/Schedule"] --> codeql["CodeQL Analysis"]
codeql --> queries["Security Queries"]
queries --> results["Code Scanning Results"]
results --> tab["Security Tab"]
File Changes1. .github/workflows/codeql.yml
|
Code Review by Qodo
1. Fork PR upload blocked
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
Pull request overview
Adds a dedicated GitHub Actions workflow to run CodeQL static analysis for the Python codebase so results appear in GitHub’s Security → Code scanning UI.
Changes:
- Introduces a new
.github/workflows/codeql.ymlworkflow triggered onpush,pull_request, and a weekly scheduled run. - Configures CodeQL for
pythonwithbuild-mode: noneand enablessecurity-extended+security-and-qualityquery suites. - Pins
actions/checkoutandgithub/codeql-actionto specific commit SHAs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| runs-on: ubuntu-latest | ||
| permissions: | ||
| security-events: write | ||
| packages: read |
Summary
Adds a CodeQL workflow so security findings surface under the repo's Security → Code scanning tab instead of relying solely on Dependabot alerts.
```yaml
on:
push: [main]
pull_request: [main]
schedule: weekly (Mon 06:00 UTC)
```
Out of scope
Test plan