-
Notifications
You must be signed in to change notification settings - Fork 0
Fix CodeQL status check name #6
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -28,15 +28,15 @@ topics: | |
|
|
||
| In repositories where {% data variables.product.prodname_code_scanning %} is configured as a pull request check, {% data variables.product.prodname_code_scanning %} checks the code in the pull request. By default, this is limited to pull requests that target the default branch, but you can change this configuration within {% data variables.product.prodname_actions %} or in a third-party CI/CD system. If merging the changes would introduce new {% data variables.product.prodname_code_scanning %} alerts to the target branch, these are reported as check results in the pull request. The alerts are also shown as annotations in the **Files changed** tab of the pull request. If you have write permission for the repository, you can see any existing {% data variables.product.prodname_code_scanning %} alerts on the **Security** tab. For information about repository alerts, see "[Managing {% data variables.product.prodname_code_scanning %} alerts for your repository](/code-security/secure-coding/managing-code-scanning-alerts-for-your-repository)." | ||
|
|
||
| If your pull request targets a protected branch that uses {% data variables.product.prodname_code_scanning %}, and the repository owner has configured required status checks, then the "{% data variables.product.prodname_code_scanning_capc %} results" check must pass before you can merge the pull request. For more information, see "[About protected branches](/github/administering-a-repository/about-protected-branches#require-status-checks-before-merging)." | ||
| If your pull request targets a protected branch that uses {% data variables.product.prodname_code_scanning %}, and the repository owner has configured required status checks, then the "CodeQL" check must pass before you can merge the pull request. For more information, see "[About protected branches](/github/administering-a-repository/about-protected-branches#require-status-checks-before-merging)." | ||
|
|
||
| ## About {% data variables.product.prodname_code_scanning %} as a pull request check | ||
|
|
||
| There are many options for configuring {% data variables.product.prodname_code_scanning %} as a pull request check, so the exact setup of each repository will vary and some will have more than one check. | ||
|
|
||
| ### {% data variables.product.prodname_code_scanning_capc %} results check | ||
|
|
||
| For all configurations of {% data variables.product.prodname_code_scanning %}, the check that contains the results of {% data variables.product.prodname_code_scanning %} is: **{% data variables.product.prodname_code_scanning_capc %} results**. The results for each analysis tool used are shown separately. Any new alerts caused by changes in the pull request are shown as annotations. | ||
| For all configurations of {% data variables.product.prodname_code_scanning %}, the check that contains the results of {% data variables.product.prodname_code_scanning %} is: **CodeQL**. The results for each analysis tool used are shown separately. Any new alerts caused by changes in the pull request are shown as annotations. | ||
|
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. 🧩 Analysis chain🌐 Web query:
💡 Result: For SARIF uploads from third-party tools, the pull request check name you’ll see (and can require as a branch protection status check) is:
If you upload multiple SARIF files for the same commit, use a distinct Sources: [1] [2] [3] 🌐 Web query:
💡 Result: In GitHub code scanning with CodeQL, there are two different “names” people often mean: 1) The GitHub Checks / status check name shown on PRsThis comes from your workflow YAML, not from CodeQL itself:
So, in advanced setup, you “configure the check name” by renaming the workflow and/or job, e.g.: name: "Security - Code Scanning"
jobs:
analyze:
name: "CodeQL (PR)"In default setup, GitHub manages the workflow for you, so you generally can’t meaningfully rename the check the same way. (docs.github.com) 2) The Code scanning run identity (how uploads are distinguished/grouped)If your real goal is to make CodeQL runs distinguishable (monorepo, multiple languages, multiple workflows), use the - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "backend/java"If you don’t set Citations:
🌐 Web query:
💡 Result: In GitHub code scanning, the “tool name” shown in the UI (and used for filtering) comes from the SARIF run’s tool metadata:
To get separate code-scanning “analyses / check results” for different tools (or multiple analyses of the same tool), GitHub distinguishes uploads by (tool, category):
Citations:
The documentation incorrectly claims "CodeQL" is the universal check name for all code scanning configurations. The check name varies by tool type:
Results from each tool are shown separately within the respective check. Update the documentation to distinguish between CodeQL-specific and third-party/SARIF configurations, or clarify that "CodeQL" is the default label only for CodeQL workflows. 🤖 Prompt for AI Agents |
||
|
|
||
| {% ifversion fpt or ghes > 3.2 or ghae-issue-4902 %} To see the full set of alerts for the analyzed branch, click **View all branch alerts**. This opens the full alert view where you can filter all the alerts on the branch by type, severity, tag, etc. For more information, see "[Managing code scanning alerts for your repository](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#filtering-and-searching-for-code-scanning-alerts)." | ||
|
|
||
|
|
||
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 chain
🌐 Web query:
GitHub code scanning status check name CodeQL third-party SARIF tools documentation💡 Result:
GitHub doesn’t have a special, fixed “code scanning / CodeQL” required status check name that you can rely on across setups. The “status checks” you can require in branch protection come from the Checks API check runs created by your workflow/jobs, so the name is determined by your GitHub Actions workflow name and job name(s). GitHub even warns to keep job names unique across workflows to avoid ambiguous required status checks. [1]
CodeQL (GitHub Actions)
<workflow name> / <job name>(for example, workflow nameCodeQLwith job names likeAnalyze (LANGUAGE)).Third-party SARIF uploads
categoryinput (or auto-generated category) affects how code scanning groups SARIF analyses (it becomesrunAutomationDetails.idin SARIF), not the branch-protection status check name. [3][4]Where to confirm the exact check name: open a PR → Checks tab (or the merge box) and copy the check’s displayed name; that exact string is what branch protection “Require status checks” will list.
Sources:
[1] GitHub Docs – About protected branches (required checks / unique job names) (docs.github.com)
[2] GitHub Docs – Viewing code scanning logs (default setup workflow run shows “CodeQL”) (docs.github.com)
[3] GitHub Docs – Uploading a SARIF file to GitHub (
upload-sarif, optionalcategory) (docs.github.com)[4] GitHub Docs – Customizing advanced setup for code scanning (how
categoryis generated and used) (docs.github.com)Citations:
Clarify check name for non‑CodeQL tools.
The check name is determined by the GitHub Actions workflow and job names, not a fixed value. For CodeQL's default setup, the check is typically named "CodeQL", but repositories using third-party code scanning tools (Trivy, Semgrep, etc.) or custom SARIF upload workflows will have different check names. Revise to indicate this varies by configuration:
Suggested wording
🤖 Prompt for AI Agents