Automatically comment on pull requests showing which packages are affected by the changes and why.
name: PR Comment
on:
pull_request:
branches: [main]
permissions:
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Rani367/affected-pr-comment@v1
with:
base: origin/mainThe action posts a comment like this on your PR:
Package Reason core directly changed: src/lib.rsapi depends on: core cli depends on: api -> core 2 file(s) changed
crates/core/src/lib.rscrates/core/src/types.rs
The comment is automatically updated on each push to the PR (no duplicate comments).
| Input | Description | Default |
|---|---|---|
base |
Base branch to compare against | origin/main |
version |
affected CLI version to install | latest |
token |
GitHub token for posting comments | ${{ github.token }} |
header |
Unique identifier for comment dedup | affected-packages |
This action requires pull-requests: write permission to post comments.
For fork PRs, use the pull_request_target event instead of pull_request:
on:
pull_request_target:
branches: [main]Note: pull_request_target runs in the context of the base branch, which has write access but uses the base branch code. Make sure to check out the PR head if needed.