From a1858733df7c19226032e24d5ebc2f089867cc6c Mon Sep 17 00:00:00 2001 From: Min Zhang Date: Thu, 20 Aug 2026 09:44:58 -0400 Subject: [PATCH] NO-ISSUE: run PR CI suites on merge_group Merge queue waits for checks on the speculative SHA. Without a merge_group trigger those jobs never report, so GitHub kicks the PR (checks_timed_out). --- .github/workflows/integration-tests.yml | 16 ++++++++++++++-- .github/workflows/pre-commit.yaml | 9 +++++---- .github/workflows/unit-tests.yml | 16 ++++++++++++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 16ca209225..653fafbd9a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - main + merge_group: workflow_dispatch: # 2x/day (every 12h). Offset 47 minutes past the hour, not on the hour -- # GitHub Actions' shared cron scheduler queues everyone's on-the-hour @@ -26,12 +27,23 @@ jobs: changes: runs-on: ubuntu-latest permissions: + contents: read pull-requests: read outputs: - should-run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code == 'true' }} + # Same ignore list for pull_request and merge_group. schedule / + # workflow_dispatch always run. Job-level `if:` skip reports success + # so docs-only PRs (and merge groups) are not blocked. + should-run: ${{ (github.event_name != 'pull_request' && github.event_name != 'merge_group') || steps.filter.outputs.code == 'true' }} steps: + # dorny/paths-filter uses git diff on merge_group (not the PR Files API), + # so the repo must be checked out with enough history for base..head. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + if: github.event_name == 'merge_group' + with: + fetch-depth: 0 + persist-credentials: false - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.event_name == 'merge_group' id: filter with: predicate-quantifier: 'every' diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 02d40bc8aa..635cea2a4f 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -2,6 +2,7 @@ name: pre-commit on: pull_request: + merge_group: jobs: pre-commit: @@ -38,7 +39,7 @@ jobs: id: gitleaks-config if: always() env: - BASE_SHA: ${{ github.event.pull_request.base.sha }} + BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} run: | set -euo pipefail git show "${BASE_SHA}:.gitleaks.toml" > /tmp/gitleaks-base.toml @@ -52,8 +53,8 @@ jobs: id: gitleaks if: always() && steps.gitleaks-config.outcome == 'success' env: - BASE_SHA: ${{ github.event.pull_request.base.sha }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} + BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} run: | set -euo pipefail docker run --rm \ @@ -76,7 +77,7 @@ jobs: # comment may fail there — accepted gap; the scan job still blocks the PR. gitleaks-rotation-comment: needs: pre-commit - if: always() && needs.pre-commit.outputs.gitleaks-failed == 'true' + if: always() && needs.pre-commit.outputs.gitleaks-failed == 'true' && github.event_name == 'pull_request' runs-on: ubuntu-latest permissions: issues: write diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2d52ef8dcd..c85a8d2180 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -18,6 +18,7 @@ on: pull_request: branches: - main + merge_group: workflow_dispatch: # 2x/day (every 12h). Offset 13 minutes past the hour, not on the hour -- # GitHub Actions' shared cron scheduler queues everyone's on-the-hour @@ -36,12 +37,23 @@ jobs: changes: runs-on: ubuntu-latest permissions: + contents: read pull-requests: read outputs: - should-run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code == 'true' }} + # Same ignore list for pull_request and merge_group. schedule / + # workflow_dispatch always run. Job-level `if:` skip reports success + # so docs-only PRs (and merge groups) are not blocked. + should-run: ${{ (github.event_name != 'pull_request' && github.event_name != 'merge_group') || steps.filter.outputs.code == 'true' }} steps: + # dorny/paths-filter uses git diff on merge_group (not the PR Files API), + # so the repo must be checked out with enough history for base..head. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + if: github.event_name == 'merge_group' + with: + fetch-depth: 0 + persist-credentials: false - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.event_name == 'merge_group' id: filter with: predicate-quantifier: 'every'