From 7ff4e6f727ee6cabc083a543b0581aca554fdc15 Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Fri, 6 Dec 2024 14:18:51 -0800 Subject: [PATCH 1/2] Prepare repo for enabling merge queue --- .github/workflows/book.yml | 1 + .github/workflows/kani.yml | 1 + .github/workflows/pr_approval.yml | 21 +++++++++++++++------ .github/workflows/rustc.yml | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 9b1ab637140c3..200068be74745 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -3,6 +3,7 @@ name: Build Book on: workflow_dispatch: + merge_group: pull_request: branches: [ main ] push: diff --git a/.github/workflows/kani.yml b/.github/workflows/kani.yml index b3c8aa3882066..7e0ccfd3551e4 100644 --- a/.github/workflows/kani.yml +++ b/.github/workflows/kani.yml @@ -2,6 +2,7 @@ name: Kani on: workflow_dispatch: + merge_group: pull_request: branches: [ main ] push: diff --git a/.github/workflows/pr_approval.yml b/.github/workflows/pr_approval.yml index f261da3ad2ac2..23d1790bd01fb 100644 --- a/.github/workflows/pr_approval.yml +++ b/.github/workflows/pr_approval.yml @@ -1,12 +1,18 @@ +# This workflow checks that the PR has been approved by 2+ members of the committee listed in `pull_requests.toml`. +# +# Run this pull request when a request review is submitted / dismissed. +# Note that an approval can be dismissed, and this can affect the job status. +# We currently trust that contributors won't make significant changes to their PRs after approval, so we accept +# changes after approval. +# +# We still need to run this in the case of a merge group, since it is a required step. In that case, the workflow +# is a NOP. name: Check PR Approvals - -# For now, the workflow gets triggered only when a review is submitted -# This technically means, a PR with zero approvals can be merged by the rules of this workflow alone -# To protect against that scenario, we can turn on number of approvals required to 2 in the github settings -# of the repository on: + merge_group: + pull_request: pull_request_review: - types: [submitted] + types: [submitted, dismissed] jobs: check-approvals: @@ -14,12 +20,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + if: ${{ github.event_name != 'merge_group' }} - name: Install TOML parser run: npm install @iarna/toml + if: ${{ github.event_name != 'merge_group' }} - name: Check PR Relevance and Approvals uses: actions/github-script@v6 + if: ${{ github.event_name != 'merge_group' }} with: script: | const fs = require('fs'); diff --git a/.github/workflows/rustc.yml b/.github/workflows/rustc.yml index 112c1f58f7ce8..498c64c3b447f 100644 --- a/.github/workflows/rustc.yml +++ b/.github/workflows/rustc.yml @@ -4,6 +4,7 @@ name: Rust Tests on: workflow_dispatch: + merge_group: pull_request: branches: [ main ] push: From c40ab3afa7caf56b85fe2196e38e10b48b7689ba Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Fri, 6 Dec 2024 15:33:56 -0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Carolyn Zech Co-authored-by: Michael Tautschnig --- .github/workflows/pr_approval.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_approval.yml b/.github/workflows/pr_approval.yml index 23d1790bd01fb..06dbb1599d93f 100644 --- a/.github/workflows/pr_approval.yml +++ b/.github/workflows/pr_approval.yml @@ -1,6 +1,6 @@ -# This workflow checks that the PR has been approved by 2+ members of the committee listed in `pull_requests.toml`. +# This workflow checks that the PR has been approved by 2+ members of the committee listed in `pull_requests.toml`. # -# Run this pull request when a request review is submitted / dismissed. +# Run this action when a pull request review is submitted / dismissed. # Note that an approval can be dismissed, and this can affect the job status. # We currently trust that contributors won't make significant changes to their PRs after approval, so we accept # changes after approval. @@ -10,7 +10,6 @@ name: Check PR Approvals on: merge_group: - pull_request: pull_request_review: types: [submitted, dismissed]