Files
changesets-action/pr-status
Bjorn Lu b072bccc4c Add simple PR comment sub-action (#636)
* Add simple PR comment sub-action

* Update rolldown config

* Add changeset

* Update readme

* Use TLA

* Add prefix

* fix merge

* Update
2026-05-30 19:39:39 +00:00
..

changesets/action/pr-status

This action generates the changesets status in PRs, e.g. whether it has changeset files and which packages will be released if the PR is merged.

It requires the repo to be checked out, and automatically fetches the PR head ref into a temporary detached worktree in order to infer the changed files and packages. It also requires the pull_request_target event to be triggered in order to have permissions to comment on the PR and to work in PRs from forks.

You can also use the pull_request event if you prefer to lock permissions down and not run for PRs from forks. Make sure to add an if check to prevent the action from failing in fork PRs:

jobs:
  pr-status:
    if: github.event.pull_request.head.repo.full_name == github.repository
    # ...

See the action metadata for details on the inputs and outputs.

Warning

Do not run untrusted code when using the pull_request_target event. The example below only checks out code and does not run any code from the PR. Read more about the pull_request_target event in the GitHub documentation.

Example setup

# .github/workflows/comment-changesets-pr-status.yml
name: Comment Changesets status in PRs

on:
  pull_request_target:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
  cancel-in-progress: true

jobs:
  pr-status:
    runs-on: ubuntu-slim
    permissions:
      contents: read # to check out files in the repo
    outputs:
      comment-body: ${{ steps.pr-status.outputs.comment-body }}
    steps:
      - name: Check out repo
        uses: actions/checkout@v6

      - name: Generate status
        id: pr-status
        uses: changesets/action/pr-status@v1

  pr-comment:
    needs: pr-status
    runs-on: ubuntu-slim
    permissions:
      pull-requests: write # to create and update comments on PRs
    steps:
      - name: Comment on PR
        uses: changesets/action/pr-comment@v1
        with:
          body: ${{ needs.pr-status.outputs.comment-body }}

The workflow uses @changesets/action/pr-comment, which is a simple GitHub Action to comment on PRs.