codeScanningGetAnalysis
Get a code scanning analysis for a repository
Details
- Method:
GET - Path:
/repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} - Operation ID:
code-scanning/get-analysis
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"
},
"analysis_id": {
"description": "The ID of the analysis, as returned from the `GET /repos/{owner}/{repo}/code-scanning/analyses` operation.",
"required": true,
"location": "path",
"type": "integer"
}
}Response Schema
{
"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('codeScanningGetAnalysis', {
# Add required parameters here
})