diff --git a/.github/workflows/require_backend_label.yml b/.github/workflows/add_reviewer_labels.yml similarity index 86% rename from .github/workflows/require_backend_label.yml rename to .github/workflows/add_reviewer_labels.yml index 08fb0b819ab..37ebcc60b1e 100644 --- a/.github/workflows/require_backend_label.yml +++ b/.github/workflows/add_reviewer_labels.yml @@ -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] @@ -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: | diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index bce18493148..0e7e6c87ce0 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -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 diff --git a/.github/workflows/ready_for_review.yml b/.github/workflows/ready_for_review.yml index 35a76b6e6fc..7599c1343b8 100644 --- a/.github/workflows/ready_for_review.yml +++ b/.github/workflows/ready_for_review.yml @@ -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 @@ -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 @@ -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 ) @@ -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: | diff --git a/.github/workflows/be_review_prs.yml b/.github/workflows/require_be_approval.yml similarity index 84% rename from .github/workflows/be_review_prs.yml rename to .github/workflows/require_be_approval.yml index b0bf256d2f1..724e6684835 100644 --- a/.github/workflows/be_review_prs.yml +++ b/.github/workflows/require_be_approval.yml @@ -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 @@ -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 @@ -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 ) @@ -75,6 +78,7 @@ 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 @@ -82,6 +86,7 @@ jobs: 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