Skip to content

Latest commit

 

History

History
89 lines (69 loc) · 3.91 KB

File metadata and controls

89 lines (69 loc) · 3.91 KB

changesets/action/pr-comment

This action creates or updates comments on PRs, aimed to complement changesets/action/pr-status.

Its features are kept intentionally simple. For advanced usecases, check out other actions such as mshick/add-pr-comment and peter-evans/create-or-update-comment.

Requirements

Caution

Do not run untrusted code when using the pull_request_target event.

pull_request_target can be useful to support PRs from forks, however it enables write permissions by default which can be a security risk if untrusted code is executed and the permissions aren't scoped down.

Usage

Tip

Check out the docs to learn how to set up commenting changesets status on PRs.

on:
  pull_request:

jobs:
  pr-comment:
    runs-on: ubuntu-slim
    permissions:
      pull-requests: write # to create and update comments on PRs (changesets/action/pr-comment)
    steps:
      - name: Comment on PR
        uses: changesets/action/pr-comment@v2
        with:
          body: Hello world!

If the action is called again for the same PR, for example, if called in another workflow run, it will update the comment it created by default.

If you use the action to create different types of comments, pass an update-id value to differentiate them.

jobs:
  pr-comment:
    # ...
    steps:
      - name: Comment on PR
        uses: changesets/action/pr-comment@v2
        with:
          body: Hello world!
          update-id: my-tag

If you want to always create new comments, pass an empty value to update-id.

jobs:
  pr-comment:
    # ...
    steps:
      - uses: changesets/action/pr-comment@v2
        with:
          body: Hello world!
          update-id: ""

API

Inputs Description
github-token The GitHub token to use for authentication. Defaults to the GitHub-provided token. To use a custom token, pass it explicitly to this input.
body Required. The comment body to post on the PR.
update-id By default, the action will create and update a comment with this id. Pass a different id to create and update a new comment, or pass an empty string to disable updating comments.
Outputs Description
comment-id The comment id of the comment that was created or updated.