List code scanning analyses for a repository
Lists the details of all code scanning analyses for a repository, starting with the most recent. The response is paginated and you can use the `page` and `per_page` parameters to list the analyses you're interested in. By default 30 analyses are listed per page. The `rules_count` field in the response give the number of rules that were run in the analysis. For very old analyses this data is not available, and `0` is returned in this field. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint. **Deprecation notice**: The `tool_name` field is deprecated and will, in future, not be included in the response for this endpoint. The example response reflects this change. The tool name can now be found inside the `tool` field.
/repos/{owner}/{repo}/code-scanning/analyses- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
Query Parameters
- tool_name code-scanning-analysis-tool-name stringoptional
The name of a code scanning tool. Only results by this tool will be listed. You can specify the tool by using either `tool_name` or `tool_guid`, but not both.
- tool_guid code-scanning-analysis-tool-guid stringoptional
The GUID of a code scanning tool. Only results by this tool will be listed. Note that some code scanning tools may not include a GUID in their analysis data. You can specify the tool by using either `tool_guid` or `tool_name`, but not both.
- page integeroptional
Page number of the results to fetch.
- per_page integeroptional
Results per page (max 100)
- ref code-scanning-ref stringoptional
The Git reference for the analyses you want to list. The `ref` for a branch can be formatted either as `refs/heads/<branch name>` or simply `<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.
- sarif_id code-scanning-analysis-sarif-id stringoptional
Filter analyses belonging to the same SARIF upload.
Responses
Response
items code-scanning-analysis object
Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name.
Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code.
The SHA of the commit to which the analysis you are uploading relates.
The time that the analysis was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
Identifies the variable values associated with the environment in which this analysis was performed.
Example: error reading field xyz
Unique identifier for this analysis.
The full Git reference, formatted as `refs/heads/<branch name>`, `refs/pull/<number>/merge`, or `refs/pull/<number>/head`.
The total number of results in the analysis.
The total number of rules used in the analysis.
An identifier for the upload.
Example: 6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53
tool code-scanning-analysis-tool objectrequired
The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data.
The name of the tool used to generate the code scanning analysis.
The version of the tool used to generate the code scanning analysis.
The REST API URL of the analysis resource.
Warning generated when processing the analysis
Example: 123 results were ignored
Response if GitHub Advanced Security is not enabled for this repository
Resource not found
Service unavailable