codeScanningUpdateAlert
Update a code scanning alert
Details
- Method:
PATCH - Path:
/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} - Operation ID:
code-scanning/update-alert
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"
},
"alert_number": {
"description": "The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the `number` field in the response from the `GET /repos/{owner}/{repo}/code-scanning/alerts` operation.",
"required": true,
"location": "path",
"type": "integer"
},
"state": {
"description": "Sets the state of the code scanning alert. You must provide `dismissed_reason` when you set the state to `dismissed`.",
"required": false,
"location": "body",
"type": "string",
"enum": [
"open",
"dismissed"
]
},
"dismissed_reason": {
"description": "**Required when the state is dismissed.** The reason for dismissing or closing the alert.",
"required": false,
"location": "body",
"type": "string",
"enum": [
"false positive",
"won't fix",
"used in tests"
]
},
"dismissed_comment": {
"description": "The dismissal comment associated with the dismissal of the alert.",
"required": false,
"location": "body",
"type": "string"
},
"create_request": {
"description": "If `true`, attempt to create an alert dismissal request.",
"required": false,
"location": "body",
"type": "boolean"
},
"assignees": {
"description": "The list of users to assign to the code scanning alert. An empty array unassigns all previous assignees from the alert.",
"required": false,
"location": "body",
"type": "array"
}
}Response Schema
{
"type": "object",
"properties": {
"number": {
"type": "integer",
"description": "The security alert number.",
"readOnly": true
},
"created_at": {
"type": "string",
"description": "The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
"format": "date-time",
"readOnly": true
},
"updated_at": {
"type": "string",
"description": "The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
"format": "date-time",
"readOnly": true
},
"url": {
"type": "string",
"description": "The REST API URL of the alert resource.",
"format": "uri",
"readOnly": true
},
"html_url": {
"type": "string",
"description": "The GitHub URL of the alert resource.",
"format": "uri",
"readOnly": true
},
"instances_url": {
"type": "string",
"description": "The REST API URL for fetching the list of instances for an alert.",
"format": "uri",
"readOnly": true
},
"state": {
"type": "string",
"description": "State of a code scanning alert.",
"nullable": true,
"enum": [
"open",
"dismissed",
"fixed"
]
},
"fixed_at": {
"type": "string",
"description": "The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
"format": "date-time",
"readOnly": true,
"nullable": true
},
"dismissed_by": {
"title": "Simple User",
"description": "A GitHub user.",
"type": "object",
"properties": {
"name": {
"nullable": true,
"type": "string"
},
"email": {
"nullable": true,
"type": "string"
},
"login": {
"type": "string",
"example": "octocat"
},
"id": {
"type": "integer",
"format": "int64",
"example": 1
},
"node_id": {
"type": "string",
"example": "MDQ6VXNlcjE="
},
"avatar_url": {
"type": "string",
"format": "uri",
"example": "https://github.com/images/error/octocat_happy.gif"
},
"gravatar_id": {
"type": "string",
"example": "41d064eb2195891e12d0413f63227ea7",
"nullable": true
},
"url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat"
},
"html_url": {
"type": "string",
"format": "uri",
"example": "https://github.com/octocat"
},
"followers_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/followers"
},
"following_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/following{/other_user}"
},
"gists_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/gists{/gist_id}"
},
"starred_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
},
"subscriptions_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/subscriptions"
},
"organizations_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/orgs"
},
"repos_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/repos"
},
"events_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/events{/privacy}"
},
"received_events_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/received_events"
},
"type": {
"type": "string",
"example": "User"
},
"site_admin": {
"type": "boolean"
},
"starred_at": {
"type": "string",
"example": "\"2020-07-09T00:17:55Z\""
},
"user_view_type": {
"type": "string",
"example": "public"
}
},
"required": [
"avatar_url",
"events_url",
"followers_url",
"following_url",
"gists_url",
"gravatar_id",
"html_url",
"id",
"node_id",
"login",
"organizations_url",
"received_events_url",
"repos_url",
"site_admin",
"starred_url",
"subscriptions_url",
"type",
"url"
],
"nullable": true
},
"dismissed_at": {
"type": "string",
"description": "The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
"format": "date-time",
"readOnly": true,
"nullable": true
},
"dismissed_reason": {
"type": "string",
"description": "**Required when the state is dismissed.** The reason for dismissing or closing the alert.",
"nullable": true,
"enum": [
"false positive",
"won't fix",
"used in tests"
]
},
"dismissed_comment": {
"type": "string",
"description": "The dismissal comment associated with the dismissal of the alert.",
"nullable": true,
"maxLength": 280
},
"rule": {
"type": "object",
"properties": {
"id": {
"nullable": true,
"type": "string",
"description": "A unique identifier for the rule used to detect the alert."
},
"name": {
"type": "string",
"description": "The name of the rule used to detect the alert."
},
"severity": {
"nullable": true,
"type": "string",
"description": "The severity of the alert.",
"enum": [
"none",
"note",
"warning",
"error"
]
},
"security_severity_level": {
"nullable": true,
"type": "string",
"description": "The security severity of the alert.",
"enum": [
"low",
"medium",
"high",
"critical"
]
},
"description": {
"type": "string",
"description": "A short description of the rule used to detect the alert."
},
"full_description": {
"type": "string",
"description": "A description of the rule used to detect the alert."
},
"tags": {
"nullable": true,
"type": "array",
"description": "A set of tags applicable for the rule.",
"items": {
"type": "string"
}
},
"help": {
"nullable": true,
"type": "string",
"description": "Detailed documentation for the rule as GitHub Flavored Markdown."
},
"help_uri": {
"nullable": true,
"type": "string",
"description": "A link to the documentation for the rule used to detect the alert."
}
}
},
"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."
}
}
},
"most_recent_instance": {
"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>`."
},
"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 the analysis that generated this alert instance was performed, such as the language that was analyzed."
},
"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."
},
"state": {
"type": "string",
"description": "State of a code scanning alert.",
"nullable": true,
"enum": [
"open",
"dismissed",
"fixed"
]
},
"commit_sha": {
"type": "string"
},
"message": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"location": {
"type": "object",
"description": "Describe a region within a file for the alert.",
"properties": {
"path": {
"type": "string"
},
"start_line": {
"type": "integer"
},
"end_line": {
"type": "integer"
},
"start_column": {
"type": "integer"
},
"end_column": {
"type": "integer"
}
}
},
"html_url": {
"type": "string"
},
"classifications": {
"type": "array",
"description": "Classifications that have been applied to the file that triggered the alert.\nFor example identifying it as documentation, or a generated file.",
"items": {
"type": "string",
"description": "A classification of the file. For example to identify it as generated.",
"nullable": true,
"enum": [
"source",
"generated",
"test",
"library"
]
}
}
}
},
"dismissal_approved_by": {
"title": "Simple User",
"description": "A GitHub user.",
"type": "object",
"properties": {
"name": {
"nullable": true,
"type": "string"
},
"email": {
"nullable": true,
"type": "string"
},
"login": {
"type": "string",
"example": "octocat"
},
"id": {
"type": "integer",
"format": "int64",
"example": 1
},
"node_id": {
"type": "string",
"example": "MDQ6VXNlcjE="
},
"avatar_url": {
"type": "string",
"format": "uri",
"example": "https://github.com/images/error/octocat_happy.gif"
},
"gravatar_id": {
"type": "string",
"example": "41d064eb2195891e12d0413f63227ea7",
"nullable": true
},
"url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat"
},
"html_url": {
"type": "string",
"format": "uri",
"example": "https://github.com/octocat"
},
"followers_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/followers"
},
"following_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/following{/other_user}"
},
"gists_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/gists{/gist_id}"
},
"starred_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
},
"subscriptions_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/subscriptions"
},
"organizations_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/orgs"
},
"repos_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/repos"
},
"events_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/events{/privacy}"
},
"received_events_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/received_events"
},
"type": {
"type": "string",
"example": "User"
},
"site_admin": {
"type": "boolean"
},
"starred_at": {
"type": "string",
"example": "\"2020-07-09T00:17:55Z\""
},
"user_view_type": {
"type": "string",
"example": "public"
}
},
"required": [
"avatar_url",
"events_url",
"followers_url",
"following_url",
"gists_url",
"gravatar_id",
"html_url",
"id",
"node_id",
"login",
"organizations_url",
"received_events_url",
"repos_url",
"site_admin",
"starred_url",
"subscriptions_url",
"type",
"url"
],
"nullable": true
},
"assignees": {
"type": "array",
"items": {
"title": "Simple User",
"description": "A GitHub user.",
"type": "object",
"properties": {
"name": {
"nullable": true,
"type": "string"
},
"email": {
"nullable": true,
"type": "string"
},
"login": {
"type": "string",
"example": "octocat"
},
"id": {
"type": "integer",
"format": "int64",
"example": 1
},
"node_id": {
"type": "string",
"example": "MDQ6VXNlcjE="
},
"avatar_url": {
"type": "string",
"format": "uri",
"example": "https://github.com/images/error/octocat_happy.gif"
},
"gravatar_id": {
"type": "string",
"example": "41d064eb2195891e12d0413f63227ea7",
"nullable": true
},
"url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat"
},
"html_url": {
"type": "string",
"format": "uri",
"example": "https://github.com/octocat"
},
"followers_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/followers"
},
"following_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/following{/other_user}"
},
"gists_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/gists{/gist_id}"
},
"starred_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
},
"subscriptions_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/subscriptions"
},
"organizations_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/orgs"
},
"repos_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/repos"
},
"events_url": {
"type": "string",
"example": "https://api.github.com/users/octocat/events{/privacy}"
},
"received_events_url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/users/octocat/received_events"
},
"type": {
"type": "string",
"example": "User"
},
"site_admin": {
"type": "boolean"
},
"starred_at": {
"type": "string",
"example": "\"2020-07-09T00:17:55Z\""
},
"user_view_type": {
"type": "string",
"example": "public"
}
},
"required": [
"avatar_url",
"events_url",
"followers_url",
"following_url",
"gists_url",
"gravatar_id",
"html_url",
"id",
"node_id",
"login",
"organizations_url",
"received_events_url",
"repos_url",
"site_admin",
"starred_url",
"subscriptions_url",
"type",
"url"
]
}
}
},
"required": [
"number",
"created_at",
"url",
"html_url",
"instances_url",
"state",
"dismissed_by",
"dismissed_at",
"dismissed_reason",
"rule",
"tool",
"most_recent_instance"
]
}Usage
from ocp_agent import OCPAgent
agent = OCPAgent()
await agent.register_api('github')
# Call this tool
result = await agent.call_tool('codeScanningUpdateAlert', {
# Add required parameters here
})