Skip to contents

Create or update a comment on a GitHub issue with a standardized format.

Usage

CommentIssue(
  intIssue,
  strTitle,
  strBody,
  strCommentID = rlang::hash(strTitle),
  lglUpdate = TRUE,
  strRunID = Sys.getenv("GITHUB_RUN_ID"),
  strOwner = GetGHOwner(),
  strRepo = GetGHRepo(),
  strGHToken = gh::gh_token()
)

Arguments

intIssue

(length-1 integer) The issue with which a check is associated.

strTitle

(length-1 character) A title for an issue.

strBody

(length-1 character) The body of an issue, PR, comment, or release, in GitHub markdown.

strCommentID

(length-1 character) A unique ID for a comment within a given context, which is usually a hash of the title of the comment.

lglUpdate

(length-1 logical) Whether to update an existing comment or label if it already exists (rather than creating a new comment or label).

strRunID

(length-1 character) ID (typically numeric but can be very long) of a GitHub Actions workflow run.

strOwner

(length-1 character) GitHub username or organization name.

strRepo

(length-1 character) GitHub repository name.

strGHToken

(length-1 character) GitHub token with permissions appropriate to the action being performed.

Value

The comment object as returned by gh::gh(), invisibly.

Examples

if (FALSE) { # interactive()
# This only works if you have an issue #1 in your repository.
CommentIssue(
  intIssue = 1,
  strTitle = "QC Report",
  strBody = "All checks passed successfully."
)
}