Skip to content

Commit

Permalink
Merge branch 'master' into experiment/githubeventnumber
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich authored Apr 16, 2024
2 parents cf68da0 + 23e4f24 commit 5a0fb86
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
id: comments
run: |
echo "github.event.number is ${{ github.event.number }} and github.event.pull_request.number is ${{ github.event.pull_request.number }}"
echo "bodies=$(gh pr view ${{ github.event.number }} --repo ${{ github.repository }} --json comments --jq '[.comments[].body]')" >> "$GITHUB_OUTPUT"
echo "reviews=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews --jq '[.[].state]')" >> "$GITHUB_OUTPUT""
echo "bodies=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json comments --jq '[.comments[].body]')" >> "$GITHUB_OUTPUT"
echo "reviews=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews --jq '[.[].state]')" >> "$GITHUB_OUTPUT""
env:
GH_TOKEN: ${{ github.token }}
- name: Fail when author pushes new code
Expand All @@ -40,11 +40,11 @@ jobs:
run: |
echo "User's association is ${{ github.event.pull_request.author_association }}"
# We get the list of reviewers who approved the PR
REVIEWERS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews \
REVIEWERS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.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 -
echo $REVIEWERS | gh api --method POST repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers --input -
echo "::error::Project needs to be reviewed again"
exit 1
Expand All @@ -54,7 +54,7 @@ jobs:
# If the previous step failed and github-actions hasn't commented yet we comment instructions
if: failure() && !contains(fromJson(steps.comments.outputs.bodies), 'Review required! Latest push from author must always be reviewed')
run: |
gh pr comment ${{ github.event.number }} --repo ${{ github.repository }} --body "Review required! Latest push from author must always be reviewed"
gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "Review required! Latest push from author must always be reviewed"
env:
GH_TOKEN: ${{ github.token }}
COMMENTS: ${{ steps.comments.outputs.users }}
Expand Down

0 comments on commit 5a0fb86

Please sign in to comment.