-
Notifications
You must be signed in to change notification settings - Fork 374
Enable codeql scanning #1532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable codeql scanning #1532
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| amends "@gha/Workflow.pkl" | ||
|
|
||
| import "@gha/catalog.pkl" | ||
|
|
||
| on { | ||
| push { | ||
| branches { | ||
| "main" | ||
| } | ||
| } | ||
| pull_request {} | ||
| schedule { | ||
| // Run at 01:38 on Saturday | ||
| new { cron = "38 1 * * 6" } | ||
| } | ||
| } | ||
|
|
||
| local class CodeQLScan { | ||
| language: String | ||
|
|
||
| `build-mode`: String | ||
| } | ||
|
|
||
| local scans: Listing<CodeQLScan> = new { | ||
| new { | ||
| language = "actions" | ||
| `build-mode` = "none" | ||
| } | ||
| new { | ||
| language = "java-kotlin" | ||
| `build-mode` = "autobuild" | ||
| } | ||
| new { | ||
| language = "javascript-typescript" | ||
| `build-mode` = "none" | ||
| } | ||
| } | ||
|
|
||
| jobs { | ||
| for (scan in scans) { | ||
| ["analyze-\(scan.language)"] { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it better/easier to go with a matrix build instead of multiple jobs? 🤔 🤷♂️
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matrices feel like a poor man's for loop that we can express much more easily with Pkl. And, you get actual Pkl dot access this way, rather than a stringy typed value ( |
||
| name = "Analyze (\(scan.language))" | ||
| `runs-on` = "ubuntu-latest" | ||
| permissions { | ||
| `security-events` = "write" | ||
| } | ||
| steps { | ||
| catalog.`actions/checkout@v6` | ||
| new { | ||
| name = "Initialize CodeQL" | ||
| uses = "github/codeql-action/init@v4" | ||
| with { | ||
| ["languages"] = scan.language | ||
| ["build-mode"] = scan.`build-mode` | ||
| } | ||
| } | ||
| new { | ||
| name = "Perform CodeQL Analysis" | ||
| uses = "github/codeql-action/analyze@v4" | ||
| with { | ||
| ["category"] = "/language:\(scan.language)" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to run this on push or PR? Having this able to block PRs would be very handy. I'd be interested in adding at least one custom query to block a problem pattern in CliCommand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was concerned about how long these things take to run. But, we can play around with it and see what happens!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis for java-kotlin finished within a minute of the gradle-check job, so I think this would probably be okay to enable on PRs. A <1m delay in exchange for better security enforcement on PRs seems okay to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added PRs