Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] - Remove reviewers and fail on push #18

Closed
wants to merge 13 commits into from
26 changes: 24 additions & 2 deletions .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Review-Trigger
name: Review-Trigger-TEST

on:
pull_request_target:
pull_request:
types:
- opened
- reopened
Expand All @@ -21,6 +21,28 @@ jobs:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Fail when author pushes new code
# Require new reviews when the author is pushing and he is not a member
if: |
github.event.action == 'synchronize' &&
github.event.sender.login == github.event.pull_request.user.login &&
github.event.pull_request.author_association != 'MEMBER'
run: |
echo "SENDER: $SENDER ; AUTHOR:$AUTHOR ; ACTION:$ACTION"
echo "::error::Project needs to be reviewed again"

# We get the list of reviewers who approved the PR
REVIEWERS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews \
--jq '{reviewers: [.[] | select(.state == "APPROVED") | .user.login]}')

# We request them to review again
echo $REVIEWERS | gh api --method POST repos/${{ github.repository }}/pulls/${{ github.event.number }}/requested_reviewers --input -
exit 1
env:
SENDER: ${{ github.event.sender.login }}
AUTHOR: ${{ github.event.pull_request.author_association }}
ACTION: ${{ github.event.action }}
GH_TOKEN: ${{ github.token }}
- name: Get PR number
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
Expand Down
Loading