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.
[!WARNING] Closing down notice: The
tool_namefield is closing down 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 thetoolfield.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ 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.
Query Parameters
Section titled “ Query Parameters ”The name of the tool used to generate the code scanning analysis.
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.
The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data.
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.
The page number of the results to fetch. For more information, see “Using pagination in the REST API.”
The number of results per page (max 100). For more information, see “Using pagination in the REST API.”
The number of the pull request for the results you want to list.
The Git reference, formatted as refs/pull/<number>/merge, refs/pull/<number>/head,
refs/heads/<branch name> or simply <branch name>.
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.
An identifier for the upload.
Example
6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53Filter analyses belonging to the same SARIF upload.
The direction to sort the results by.
The property by which to sort the results.
Responses
Section titled “ Responses ”Response
object
The Git reference, formatted as refs/pull/<number>/merge, refs/pull/<number>/head,
refs/heads/<branch name> or simply <branch name>.
The SHA of the commit to which the analysis you are uploading relates.
Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name.
Identifies the variable values associated with the environment in which this analysis was performed.
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 time that the analysis was created in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
The total number of results in the analysis.
The total number of rules used in the analysis.
Unique identifier for this analysis.
The REST API URL of the analysis resource.
An identifier for the upload.
object
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 GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data.
Warning generated when processing the analysis
Examples
[ { "ref": "refs/heads/main", "commit_sha": "d99612c3e1f2970085cfbaeadf8f010ef69bad83", "analysis_key": ".github/workflows/codeql-analysis.yml:analyze", "environment": "{\"language\":\"python\"}", "error": "", "category": ".github/workflows/codeql-analysis.yml:analyze/language:python", "created_at": "2020-08-27T15:05:21Z", "results_count": 17, "rules_count": 49, "id": 201, "url": "https://api.github.com/repos/octocat/hello-world/code-scanning/analyses/201", "sarif_id": "6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53", "tool": { "name": "CodeQL", "guid": null, "version": "2.4.0" }, "deletable": true, "warning": "" }, { "ref": "refs/heads/my-branch", "commit_sha": "c8cff6510d4d084fb1b4aa13b64b97ca12b07321", "analysis_key": ".github/workflows/shiftleft.yml:build", "environment": "{}", "error": "", "category": ".github/workflows/shiftleft.yml:build/", "created_at": "2020-08-31T22:46:44Z", "results_count": 17, "rules_count": 32, "id": 200, "url": "https://api.github.com/repos/octocat/hello-world/code-scanning/analyses/200", "sarif_id": "8981cd8e-b078-4ac3-a3be-1dad7dbd0b582", "tool": { "name": "Python Security Analysis", "guid": null, "version": "1.2.0" }, "deletable": true, "warning": "" }]Response if GitHub Advanced Security is not enabled for this repository
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Service unavailable
object
Example generated
{ "code": "example", "message": "example", "documentation_url": "example"}