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

DRAFT #18886

Closed
wants to merge 6 commits into from
Closed

DRAFT #18886

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Label Pull Request Reviewers
name: Add Reviewer Labels
on:
pull_request:
types: [opened, reopened, review_requested, synchronize, ready_for_review, unlabeled]
Expand Down Expand Up @@ -59,10 +59,10 @@ jobs:
- name: Add require-backend-approval label
uses: actions-ecosystem/action-add-labels@v1
if: |
github.event.pull_request.draft == false &&
!contains(toJSON(github.event.pull_request.requested_teams.*.name), 'mobile') &&
!contains(toJSON(github.event.pull_request.requested_teams.*.name), 'lighthouse') &&
!contains(toJSON(github.event.pull_request.requested_teams.*.name), 'identity')
github.event.pull_request.draft == false &&
!contains(toJSON(github.event.pull_request.requested_teams.*.name), 'mobile') &&
!contains(toJSON(github.event.pull_request.requested_teams.*.name), 'lighthouse') &&
!contains(toJSON(github.event.pull_request.requested_teams.*.name), 'identity')
with:
number: ${{ github.event.pull_request.number }}
labels: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
timeout-minutes: 20
run: |
docker compose -f docker-compose.test.yml run web bash \
-c "CI=true DISABLE_BOOTSNAP=true bundle exec parallel_rspec spec/ modules/ -n 24 -o '--color --tty'"
-c "CI=true DISABLE_BOOTSNAP=true bundle exec rspec spec/middleware/faraday/middleware_default_options_spec.rb -n 24 -o '--color --tty'"

- name: Upload Coverage Report
uses: actions/upload-artifact@v4
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/ready_for_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ jobs:
run: |
echo "ready_for_review=true" >> $GITHUB_OUTPUT

# If require-backend-approval label is present, get reviews
- name: Check backend-review-group approval status
# If backend-review-group approval is required, get reviews
- name: Get PR Reviews
if: contains(github.event.pull_request.labels.*.name, 'require-backend-approval')
id: check_backend_review_group_approval_status
id: get_pr_reviews
uses: octokit/request-action@v2.x
with:
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#
# If backend-review-group approval is required, get team members
- name: Get backend-review-group members
if: contains(github.event.pull_request.labels.*.name, 'require-backend-approval')
id: get_team_members
Expand All @@ -65,6 +65,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}

# If backend-review-group approval is required, confirm an approval exists from at least one BE team member
- name: Verify backend-review-group approval
if: contains(github.event.pull_request.labels.*.name, 'require-backend-approval')
id: verify_approval
Expand All @@ -75,7 +76,7 @@ jobs:
)

APPROVALS=$(cat <<'EOF' | jq -r '.[] | select(.state == "APPROVED") | .user.login' | grep -iE "$BACKEND_REVIEWERS" | wc -l
${{ steps.check_backend_review_group_approval_status.outputs.data }}
${{ steps.get_pr_reviews.outputs.data }}
EOF
)

Expand All @@ -99,6 +100,7 @@ jobs:
labels: |
ready-for-backend-review

# Remove ready-for-backend-review label if draft or any failures from previous steps
- name: Remove Review label
uses: actions-ecosystem/action-remove-labels@v1
if: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ jobs:
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN


# Find Backend Labels, Approvals and Comments
- name: Find Approval Comment
# Find BE Approval comment
- name: Find BE Approval Comment
uses: peter-evans/find-comment@v3
id: find_backend_approval_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Backend-review-group approval confirmed.
body-includes: "Backend-review-group approval confirmed."

# If backend-review-group approval is required, get team members
- name: Get backend-review-group members
if: contains(github.event.pull_request.labels.*.name, 'require-backend-approval')
id: get_team_members
Expand All @@ -44,15 +45,17 @@ jobs:
env:
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}

- name: Check backend-review-group approval status
# If backend-review-group approval is required, get reviews
- name: Get PR Reviews
if: contains(github.event.pull_request.labels.*.name, 'require-backend-approval')
id: check_backend_review_group_approval_status
id: get_pr_reviews
uses: octokit/request-action@v2.x
with:
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number || github.event.pull_request_review.pull_request.number }}/reviews
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# If backend-review-group approval is required, confirm an approval exists from at least one BE team member
- name: Verify backend-review-group approval
if: contains(github.event.pull_request.labels.*.name, 'require-backend-approval')
id: verify_approval
Expand All @@ -63,7 +66,7 @@ jobs:
)

APPROVALS=$(cat <<'EOF' | jq -r '.[] | select(.state == "APPROVED") | .user.login' | grep -iE "$BACKEND_REVIEWERS" | wc -l
${{ steps.check_backend_review_group_approval_status.outputs.data }}
${{ steps.get_pr_reviews.outputs.data }}
EOF
)

Expand All @@ -75,13 +78,15 @@ jobs:
echo "approval_status=confirmed" >> $GITHUB_OUTPUT
fi

# If approved and no "Approved" comment, add comment
- name: Comment PR - Approval Confirmed
if: success() && steps.verify_approval.outputs.approval_status == 'confirmed' && steps.find_backend_approval_comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: "Backend-review-group approval confirmed."

# If approved and has ready-for-review label, remove label
- name: Remove ready-for-review label
if: success() && steps.verify_approval.outputs.approval_status == 'confirmed' && contains(github.event.pull_request.labels.*.name, 'ready-for-backend-review')
uses: actions-ecosystem/action-remove-labels@v1
Expand Down
Loading