Description Usage Arguments Details Value Examples
This function creates a new comment for the specified gist, issue, pull
request or commit in GitHub. A standard comment is created for a gist or
issue (note: since a pull request is also an issue a standard comment is also
created if the issue
argument is set to the pull request number) and a
review comment is created for pull requests and commits.
1 2 3 4 5 6 7 8 9 10 11 | create_comment(
body,
gist,
issue,
pull_request,
commit,
repo,
path,
position,
...
)
|
body |
(string) The content of the comment. |
gist |
(string, optional) The ID of the gist. |
issue |
(integer, optional) The issue number. |
pull_request |
(integer, optional) The pull request number. |
commit |
(string, optional) Either a SHA or branch used to identify the commit. |
repo |
(string) The repository specified in the format: |
path |
(string, optional) The path of the file to add the comment to. |
position |
(integer, optional) The line number in the file to attach the comment to. |
... |
Parameters passed to |
When creating a gist comment only the body
and gist
ID need to be
specified; for an issue the body
, issue
number and repo
must be
specified; and for a pull request or commit the body
, pull_request
number
or commit
reference, repo
, path
and position
must be specified.
For more details see the GitHub API documentation:
https://docs.github.com/en/rest/reference/gists#create-a-gist-comment
https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
https://docs.github.com/en/rest/reference/pulls#create-a-review-comment-for-a-pull-request
https://docs.github.com/en/rest/reference/repos#create-a-commit-comment
create_comment()
returns a list of the comment's properties.
Comment Properties:
id: The id of the comment.
body: The content of the comment.
commit: The commit associated with the comment (only for pull request or commit comments).
path: The path of the file to add the comment to (only for pull request or commit comments).
position: The line number in the file to attach the comment to (only for pull request or commit comments).
user: The comment author's account login.
html_url: The address of the comment's web page.
created_at: The time and date the comment was created.
published_at: The time and date the comment was published.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
# Create a comment on a gist
create_comment(
body = "This is a comment created by create_comment()",
gist = "806dca6b09a39e7b6326a0c8137583e6"
)
# Create a comment on an issue
create_comment(
body = "This is a comment created by create_comment()",
issue = "test issue",
repo = "ChadGoymer/githapi"
)
# Create a comment on a pull request
create_comment(
body = "This is a comment created by create_comment()",
pull_request = "test pull request",
commit = "test-branch",
repo = "ChadGoymer/githapi",
path = "test-comments.txt",
position = 1
)
# Create a comment on a commit
create_comment(
body = "This is a comment created by create_comment()",
commit = "main",
repo = "ChadGoymer/githapi",
path = "README.md",
position = 1
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.