Action to retrieve review data for a pull request.
Heavily inspired by: https://github.com/jrylan/github-action-reviews-counter
The differences are:
- Allows pass inputs instead of using event data
- Ouputs more outputs
- Allows definition of Allowed Author Associations to calculate the counts
Required Github repo token, usually secrets.GITHUB_TOKEN
The organization/user owns the repository, default from event data
Pull request number to look for, default from event data
the repo name (reponame in the owner scope without owner path) where the pull request is located, default from event data
This can be one or multiple of: 'COLLABORATOR', 'CONTRIBUTOR', 'FIRST_TIME_CONTRIBUTOR', 'FIRST_TIMER', 'MEMBER', 'OWNER', 'NONE'
Multiple values are to be separated by ,
(comma). For example: COLLABORATOR,CONTRIBUTOR
, Defaults to All possible
This can be used to perform extra calculations only for given collaborator associations
Count of the Reamining Review Requestes of the Pull Reqeuest. This will be 0 when all requested Peoples (Teams) have given their Reviews
Count of the given reviews in all states.
Overal Count of the Reviews with Approvals
Overal Count of the Reviews wich Requests changes
Overal Count of the Reviews with only comments
Overal Count of the Dismissed Reviews
Overal Count of the Pending Reviews
These outputs will contain calculated amount of reviews by Status and Author Association
for example: approved_collaborator
or changes_requested_first_time_contributor
Usefull for more detailed info
This will contain amount of reviews by state for Allowed Collaborators
which is defined by collaborators
input. If no collaborators specified will equal to the overal counts. For Example: approved_collaborators
, or commented_collaborators
Process Pull request if all reviews are submitted and positive
name: Pull Request Approval
on:
pull_request_review:
types: [edited, dismissed, submitted]
jobs:
process:
steps:
- uses: jurijzahn8019/[email protected]
id: checker
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Do Something if all reviews were given and positive
if: >-
${{
steps.checker.outputs.requested < 1
&& steps.checker.outputs.approved > 0
&& steps.reviews.outputs.changes_requested < 1
}}
run: |
echo "do something with the pull request"
Other examples how to modify a PR
name: Pull Request Review
on:
pull_request_target:
types: [review_requested, review_request_removed, ready_for_review]
jobs:
process:
steps:
# You can also pass all required inputs as options
- uses: jurijzahn8019/[email protected]
id: checker
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
number: ${{ github.event.pull_request.number }}
- name: Do Something if all reviews were given regardless their state
if: >-
${{
steps.checker.outputs.requested < 1
&& steps.checker.outputs.reviews > 0
}}
run: |
echo "do something with the pull request"
- name: Move Pull back into Progress because there are no Reviewers assigned
if: >-
${{
steps.checker.outputs.requested < 1
&& steps.checker.outputs.reviews < 1
}}
run: |
echo "do something with the pull request"
DEBUG_DEPTH=8 DEBUG=action-get-pull-review-info* \
INPUT_TOKEN=$GITHUB_TOKEN \
INPUT_OWNER="my-org" \
INPUT_REPO="my-repo"
INPUT_NUMBER=666 \
ts-node src/index.ts
DEBUG_DEPTH=8 DEBUG=action-get-pull-review-info* \
INPUT_TOKEN=$GITHUB_TOKEN \
GITHUB_EVENT_PATH=fixtures/review.submitted.event.json \
ts-node src/index.ts