Commit 934f6b5
Add CodeQL code scanning workflow (Python, JavaScript/TypeScript, C#, Go) (#15)
Adds CodeQL analysis to gate PRs and run on schedule across the
languages present in the monorepo, using the `Analyze Samples` workflow
(named to mirror the existing `Validate Samples` workflow).
## Workflow design
- **Separate jobs per language** (`analyze-python`,
`analyze-javascript`, `analyze-dotnet`, `analyze-go`) so each produces
an independent status check that can be individually required in branch
protection rules
- Job display names follow the same pattern as the validation workflow:
`Analyze Python Samples`, `Analyze JavaScript/TypeScript Samples`,
`Analyze .NET Samples`, `Analyze Go Samples`
- `if: github.repository == 'AzureCosmosDB/samples'` guard on the
`Perform CodeQL Analysis` step (SARIF upload) ensures fork PRs complete
the jobs successfully — satisfying required status checks — while the
upload is skipped where `security-events: write` is unavailable
- `workflow_dispatch` added for on-demand scans
- `queries: security-and-quality` on all jobs — reference examples only
use default security queries, missing code quality coverage
- Workflow-level `concurrency` with `cancel-in-progress: true` prevents
redundant queued runs on rapid pushes
## Per-language build modes
| Language | Build mode | Notes |
|---|---|---|
| Python | `none` | Interpreted; no build needed |
| JavaScript/TypeScript | `none` | Source-only analysis; compilation is
handled by the validation workflow |
| C# | `none` | Source-only analysis; compilation is handled by the
validation workflow |
| Go | `autobuild` | Works with module-per-sample layout |
## Repository setup required
1. **Branch protection** (Settings → Branches → `main`): add `Analyze
Samples / Analyze Python Samples`, `Analyze Samples / Analyze
JavaScript/TypeScript Samples`, `Analyze Samples / Analyze .NET
Samples`, `Analyze Samples / Analyze Go Samples` as required status
checks after the first workflow run
2. **Alert thresholds** (Settings → Code security → Code scanning):
configure High/Critical to block PRs
3. **Private repos only**: GitHub Advanced Security must be enabled;
public repos get this free
## Extending for future languages
Add a new job when `java/` directories land — `java-kotlin` with
`build-mode: none`.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Send tasks to Copilot coding agent from
[Slack](https://gh.io/cca-slack-docs) and
[Teams](https://gh.io/cca-teams-docs) to turn conversations into code.
Copilot posts an update in your thread when it's finished.
---------
Signed-off-by: Sidney Andrews <sidandrews@microsoft.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>
Co-authored-by: Sidney Andrews <sidandrews@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 585653e commit 934f6b5
1 file changed
Lines changed: 107 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
0 commit comments