Create a commit comment
POST
/repos/{owner}/{repo}/commits/{commit_sha}/comments https://api.github.com
Create a comment for a commit using its :commit_sha.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will includebody. This is the default if you do not pass any specific media type.application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will includebody_text.application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will includebody_html.application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will includebody,body_text, andbody_html.
Parameters
path Path Parameters
| Name | Type |
|---|---|
owner
required
The account owner of the repository. The name is not case sensitive. | string |
repo
required
The name of the repository without the | string |
commit_sha
required
The SHA of the commit. | string |
Request Body
application/json
required
{
body: string;
path?: string;
position?: number;
line?: number;
}
body: string;
path?: string;
position?: number;
line?: number;
}
Responses
201 application/json
Response
interface CommitComment {
html_url: string;
url: string;
id: number;
node_id: string;
body: string;
path: string | null;
position: number | null;
line: number | null;
commit_id: string;
user:SimpleUser | null;
created_at: string;
updated_at: string;
author_association:AuthorAssociation ;
reactions?:ReactionRollup ;
}
html_url: string;
url: string;
id: number;
node_id: string;
body: string;
path: string | null;
position: number | null;
line: number | null;
commit_id: string;
user:
created_at: string;
updated_at: string;
author_association:
reactions?:
}
Client Errors
403 application/json
Forbidden
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
422 application/json
Validation failed, or the endpoint has been spammed.
interface ValidationError {
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}[];
}
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}[];
}