PR Insights Action
“A GitHub Action That Reads Your Pull Requests”
Reviewing a large pull request often means scrolling through the diff to understand its scope. How many files changed? Which files were added versus modified? How many commits are in this branch? This action answers those questions automatically and posts them as a comment on the PR.
What it does
When a pull request is opened or updated, the action fetches PR data from the GitHub API and generates:
- PR statistics: additions, deletions, total files changed, number of commits
- File breakdown: every changed file with a status indicator (added, modified, removed, renamed), file size, and change count
- Commit summary: list of commits with authors, messages, and timestamps
- A comment on the PR: the full report posted as a Markdown comment visible to the entire team
Design decisions
Vanilla JavaScript, no TypeScript. The action is a single file compiled with ncc into a distributable bundle. Adding TypeScript for a project this small would add build complexity without proportional benefit.
No external API dependencies. The action uses only the built-in GITHUB_TOKEN and the GitHub REST API. No third-party services, no API keys to manage, no rate limits beyond GitHub’s own.
Comments instead of just JSON output. The action outputs both structured JSON (for programmatic consumption) and a Markdown comment posted directly on the PR (for human reviewers). The comment is the most visible artifact. It appears in the PR timeline where everyone already looks.
Configurable detail level. The show-files and show-commits inputs let teams decide how verbose the report should be. A small PR review team might want full file breakdowns. A large team with many small PRs might just want the summary statistics.
Usage
name: PR Insights
on:
pull_request:
types: [opened, synchronize]
permissions:
pull-requests: write
jobs:
insights:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: adurrr/pr-insights-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Published on the GitHub Marketplace at v1.0.0.