Skip to content

Commit

Permalink
edit to approval workflow to avoid marking a failed action (#650)
Browse files Browse the repository at this point in the history
Rather than having a bunch of red 'X's on PRs that haven't gotten the
required +2 review, we could have a conditional step that only runs when
the required approvals are met. If we mark this as the required step in
our branch rules it has the same effect, without cluttering our PR
status with a bunch of failed status checks

---------

Signed-off-by: Peter St. John <[email protected]>
Signed-off-by: Polina Binder <[email protected]>
  • Loading branch information
pstjohn authored and polinabinder1 committed Jan 28, 2025
1 parent 7aee88b commit 32e5f91
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/approvals.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Enforce Tiered Approvals

on:
pull_request: # TODO: remove
pull_request_review:

env:
TIER2_REVIEWERS: "jstjohn,trvachov,pstjohn"

jobs:
enforce_tiered_approvals:
check_approval:
runs-on: ubuntu-latest

outputs:
status: ${{ steps.check_tier2.outputs.status }}
steps:
- name: Get PR reviews
id: get_reviews
Expand Down Expand Up @@ -59,8 +61,15 @@ jobs:
done
if [[ "$TIER2_APPROVED" == "true" ]]; then
echo "A +2 reviewer has approved the pull request."
echo "status=passed" >> $GITHUB_OUTPUT
else
echo "No +2 reviewer has approved the pull request."
exit 1
echo "status=failed" >> $GITHUB_OUTPUT
fi
has_approval:
needs: check_approval
if : ${{ needs.check_approval.outputs.status == 'passed' }}
runs-on: ubuntu-latest
steps:
- name: Approved
run: echo "This PR has been approved by a Tier 2 reviewer."

0 comments on commit 32e5f91

Please sign in to comment.