reposCreateOrUpdateFileContents
Create or update file contents
Details
- Method:
PUT - Path:
/repos/{owner}/{repo}/contents/{path} - Operation ID:
repos/create-or-update-file-contents
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"
},
"path": {
"description": "path parameter",
"required": true,
"location": "path",
"type": "string"
},
"message": {
"description": "The commit message.",
"required": true,
"location": "body",
"type": "string"
},
"content": {
"description": "The new file content, using Base64 encoding.",
"required": true,
"location": "body",
"type": "string"
},
"sha": {
"description": "**Required if you are updating a file**. The blob SHA of the file being replaced.",
"required": false,
"location": "body",
"type": "string"
},
"branch": {
"description": "The branch name. Default: the repositoryβs default branch.",
"required": false,
"location": "body",
"type": "string"
},
"committer": {
"description": "The person that committed the file. Default: the authenticated user.",
"required": false,
"location": "body",
"type": "object"
},
"author": {
"description": "The author of the file. Default: The `committer` or the authenticated user if you omit `committer`.",
"required": false,
"location": "body",
"type": "object"
}
}Response Schema
{
"title": "File Commit",
"description": "File Commit",
"type": "object",
"required": [
"content",
"commit"
],
"properties": {
"content": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
},
"size": {
"type": "integer"
},
"url": {
"type": "string"
},
"html_url": {
"type": "string"
},
"git_url": {
"type": "string"
},
"download_url": {
"type": "string"
},
"type": {
"type": "string"
},
"_links": {
"type": "object",
"properties": {
"self": {
"type": "string"
},
"git": {
"type": "string"
},
"html": {
"type": "string"
}
}
}
},
"nullable": true
},
"commit": {
"type": "object",
"properties": {
"sha": {
"type": "string"
},
"node_id": {
"type": "string"
},
"url": {
"type": "string"
},
"html_url": {
"type": "string"
},
"author": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"committer": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"message": {
"type": "string"
},
"tree": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"sha": {
"type": "string"
}
}
},
"parents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"html_url": {
"type": "string"
},
"sha": {
"type": "string"
}
}
}
},
"verification": {
"type": "object",
"properties": {
"verified": {
"type": "boolean"
},
"reason": {
"type": "string"
},
"signature": {
"type": "string",
"nullable": true
},
"payload": {
"type": "string",
"nullable": true
},
"verified_at": {
"type": "string",
"nullable": true
}
}
}
}
}
}
}Usage
from ocp_agent import OCPAgent
agent = OCPAgent()
await agent.register_api('github')
# Call this tool
result = await agent.call_tool('reposCreateOrUpdateFileContents', {
# Add required parameters here
})