codeScanningListRecentAnalyses
List code scanning analyses for a repository
Details
- Method:
GET - Path:
/repos/{owner}/{repo}/code-scanning/analyses - Operation ID:
code-scanning/list-recent-analyses
Parameters
{
"owner": {
"description": "The account owner of the repository. The name is not case sensitive.",
"required": true,
"location": "path",
"type": "string"
},
"repo": {
"description": "The name of the repository without the `.git` extension. The name is not case sensitive.",
"required": true,
"location": "path",
"type": "string"
},
"tool_name": {
"description": "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.",
"required": false,
"location": "query",
"type": "string"
},
"tool_guid": {
"description": "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.",
"required": false,
"location": "query",
"type": "string"
},
"page": {
"description": "The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
"required": false,
"location": "query",
"type": "integer"
},
"per_page": {
"description": "The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
"required": false,
"location": "query",
"type": "integer"
},
"pr": {
"description": "The number of the pull request for the results you want to list.",
"required": false,
"location": "query",
"type": "integer"
},
"ref": {
"description": "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`.",
"required": false,
"location": "query",
"type": "string"
},
"sarif_id": {
"description": "Filter analyses belonging to the same SARIF upload.",
"required": false,
"location": "query",
"type": "string"
},
"direction": {
"description": "The direction to sort the results by.",
"required": false,
"location": "query",
"type": "string",
"enum": [
"asc",
"desc"
]
},
"sort": {
"description": "The property by which to sort the results.",
"required": false,
"location": "query",
"type": "string",
"enum": [
"created"
]
}
}Response Schema
{
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "string",
"description": "The Git reference, formatted as `refs/pull/<number>/merge`, `refs/pull/<number>/head`,\n`refs/heads/<branch name>` or simply `<branch name>`."
},
"commit_sha": {
"description": "The SHA of the commit to which the analysis you are uploading relates.",
"type": "string",
"minLength": 40,
"maxLength": 40,
"pattern": "^[0-9a-fA-F]+$"
},
"analysis_key": {
"type": "string",
"description": "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."
},
"environment": {
"type": "string",
"description": "Identifies the variable values associated with the environment in which this analysis was performed."
},
"category": {
"type": "string",
"description": "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."
},
"error": {
"type": "string",
"example": "error reading field xyz"
},
"created_at": {
"type": "string",
"description": "The time that the analysis was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
"format": "date-time",
"readOnly": true
},
"results_count": {
"type": "integer",
"description": "The total number of results in the analysis."
},
"rules_count": {
"type": "integer",
"description": "The total number of rules used in the analysis."
},
"id": {
"type": "integer",
"description": "Unique identifier for this analysis."
},
"url": {
"type": "string",
"description": "The REST API URL of the analysis resource.",
"format": "uri",
"readOnly": true
},
"sarif_id": {
"type": "string",
"description": "An identifier for the upload.",
"example": "6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53"
},
"tool": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the tool used to generate the code scanning analysis."
},
"version": {
"nullable": true,
"type": "string",
"description": "The version of the tool used to generate the code scanning analysis."
},
"guid": {
"nullable": true,
"type": "string",
"description": "The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data."
}
}
},
"deletable": {
"type": "boolean"
},
"warning": {
"type": "string",
"description": "Warning generated when processing the analysis",
"example": "123 results were ignored"
}
},
"required": [
"ref",
"commit_sha",
"analysis_key",
"environment",
"error",
"created_at",
"results_count",
"rules_count",
"id",
"url",
"sarif_id",
"tool",
"deletable",
"warning"
]
}
}Usage
from ocp_agent import OCPAgent
agent = OCPAgent()
await agent.register_api('github')
# Call this tool
result = await agent.call_tool('codeScanningListRecentAnalyses', {
# Add required parameters here
})