Open Context Protocol is live! 🚀 Read the launch post
codeScanningCommitAutofix

codeScanningCommitAutofix

Commit an autofix for a code scanning alert

Details

  • Method: POST
  • Path: /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commits
  • Operation ID: code-scanning/commit-autofix

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"
  },
  "target_ref": {
    "description": "The Git reference of target branch for the commit. Branch needs to already exist.  For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "message": {
    "description": "Commit message to be used.",
    "required": false,
    "location": "body",
    "type": "string"
  }
}

Response Schema

{
  "type": "object",
  "properties": {
    "target_ref": {
      "type": "string",
      "description": "The Git reference of target branch for the commit. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation."
    },
    "sha": {
      "type": "string",
      "description": "SHA of commit with autofix."
    }
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('github')

# Call this tool
result = await agent.call_tool('codeScanningCommitAutofix', {
    # Add required parameters here
})