Get a code scanning analysis for a repository
Gets a specified code scanning analysis for a repository. You must use an access token with the security_events scope to use this endpoint with private repos, the public_repo scope also grants permission to read security events on public repos only. GitHub Apps must have the security_events read permission to use this endpoint.
The default JSON response contains fields that describe the analysis. This includes the Git reference and commit SHA to which the analysis relates, the datetime of the analysis, the name of the code scanning tool, and the number of alerts.
The rules_count field in the default 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.
If you use the Accept header application/sarif+json, the response contains the analysis data that was uploaded. This is formatted as SARIF version 2.1.0.
Path parameters
The account owner of the repository. The name is not case sensitive.
The name of the repository without the .git extension. The name is not case sensitive.
The ID of the analysis, as returned from the GET /repos/{owner}/{repo}/code-scanning/analyses operation.
Response
Response
Example response
{
"error": "error reading field xyz",
"sarif_id": "6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53",
"warning": "123 results were ignored"
}