Skip to content

Github action to print relevant stats about Pull Request reviewers

License

Notifications You must be signed in to change notification settings

fo2rist/pull-request-stats

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

Pull Request Stats

CI GitHub Marketplace

Github action to print relevant stats about Pull Request reviewers. Fork of the pull-request-stats without telemtery and with extra features.

Running this action will add a section at the bottom of your pull requests description:

Each reviewer can have a link pointing to their historical behavior of each reviewer:

Privacy

  • No repository data is collected, stored or distributed by this GitHub action. This action is state-less
  • No telemetry is collected
  • Charts data is send over the URL, and never stored or transmitted anywhere else
  • Charts links are disabled by default

Usage

Add this action to one of your workflow files:

      - name: Post pull request stats
        uses: fo2rist/pull-request-stats@master

Action inputs

The possible inputs for this action are:

Parameter Description Default
token GITHUB_TOKEN or a Personal Access Token with "repo" permission. GITHUB_TOKEN
repositories A comma separated list of github repositories to calculate the stats. When specifying other repo(s) it is mandatory to pass a Personal Access Token in the token parameter. Current repository
organization If you prefer, you may specify the name of your organization to calculate the stats across all of its repos. When specifying an organization it is mandatory to pass a Personal Access Token in the token parameter. null
excluded-reviewers User to exclude from stat (should be a string with JSON array of user IDs e.g '["@fo2rist"]'). '[]'
period The length of the period used to calculate the stats, expressed in days. 30
charts Whether to add a chart to the start or not. Possible values: true or false. false
summary Whether to add summary stats for period. true
disable-links If true, removes the links to the detailed charts. Possible values: true or false. true
sort-by The column used to sort the data. Possible values: REVIEWS, TIME, COMMENTS. REVIEWS
limit The maximum number of rows to display in the table. A value of 0 means unlimited. 0

Examples

Minimal config

Add this to the file .github/workflows/stats.yml in your repo:

name: Pull Request Stats

on: pull_request

jobs:
  stats:
    runs-on: ubuntu-latest
    steps:
      - name: Run pull request stats
        uses: fo2rist/pull-request-stats@master

This config will add a table like this to PR description:

User Total reviews Median time to review Total comments
jartmez 37 22m 13
manuelmhtr 35 48m 96
ernestognw 25 1h 27m 63
javierbyte 12 30m 0
Phaze1D 4 34m 1

Visual config

Add this to the file .github/workflows/stats.yml:

name: Pull Request Stats

on: pull_request

jobs:
  stats:
    runs-on: ubuntu-latest
    steps:
      - name: Run pull request stats
        uses: fo2rist/pull-request-stats@master
        with:
          token: ${{ secrets.ADD_A_PERSONAL_ACCESS_TOKEN }}
          organization: 'piedpiper'
          period: 7
          charts: true
          disable-links: true
          sort-by: 'COMMENTS'
          excluded-reviewers: '["fo2rist", "fo2rist"]'

This config will:

  • Calculate the reviewer stats for all the repos in the "piedpiper" organization in the lasts 7 days
  • Display charts for the metrics
  • Remove the links to detailed charts
  • Sort results by the "comments" column

and add a table like this:

User Total comments Total reviews Median time to review
manuelmhtr
🥇
12
▀▀▀▀▀▀▀▀
8
▀▀▀▀
53m
jartmez
🥈
3
▀▀
4
▀▀
58m
JohanAlvarado
🥉
1
2
1d 16h 18m
▀▀▀▀▀▀
Estebes10
1
1
19m
ernestognw
0
2
2h 15m
Phaze1D
0
3
1h 28m
javierbyte
0
1
21h 24m
▀▀▀

Stats

The stats are calculated as following:

  • Time to review: It is the time taken by a reviewer from the Pull Request publication or the last Commit push (whatever happens last) to the first time the pull request is reviewed.
  • Median time to review: It is the median of the times to review of all Pull Requests reviewed by a person in the period.
  • Total reviews: It is the count of all Pull Requests reviewed by a person in the period.
  • Total comments: It is the count of all the comments while reviewing other user's Pull Requests in the period (comments in own PRs don't count).

License

AGPLv3

About

Github action to print relevant stats about Pull Request reviewers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%