From 021089ba4812edd6ccad477fc44fdd1a026bc825 Mon Sep 17 00:00:00 2001 From: Nicholas Bucher Date: Fri, 4 Sep 2026 16:34:33 -0400 Subject: [PATCH] ci: run the required checks from the merge queue too A merge queue fires `merge_group`, not `pull_request`, so without this trigger the required checks never start and the queue stalls. The migration check also read `github.base_ref`, which is empty for a merge group. Signed-off-by: Nicholas Bucher (cherry picked from commit 764365063c4436216d1ec570752ae1d8429e5013) Signed-off-by: Nicholas Bucher --- .github/workflows/ci.yaml | 4 +++- .github/workflows/migration-immutability.yaml | 6 +++++- .github/workflows/sqlc-generate-check.yaml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index adcab2446..6abfceeaf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,12 +9,14 @@ on: branches: [main, "release/**"] paths-ignore: - "**/*.md" + merge_group: workflow_dispatch: env: # Cache key components for better organization CACHE_KEY_PREFIX: kagent-v2 - BRANCH_CACHE_KEY: ${{ github.head_ref || github.ref_name }} + # Merge groups share one cache scope; their ref names are unique and would each write a throwaway one. + BRANCH_CACHE_KEY: ${{ github.head_ref || (github.event.merge_group.base_ref && 'merge-queue') || github.ref_name }} AGENT_SANDBOX_VERSION: v0.3.10 # Consistent builder configuration BUILDX_BUILDER_NAME: kagent-builder-v0.23.0 diff --git a/.github/workflows/migration-immutability.yaml b/.github/workflows/migration-immutability.yaml index dfb5d23cb..cf17e8532 100644 --- a/.github/workflows/migration-immutability.yaml +++ b/.github/workflows/migration-immutability.yaml @@ -5,6 +5,7 @@ on: branches: [main, "release/**"] paths: - "go/core/pkg/migrations/**" + merge_group: jobs: check: @@ -15,11 +16,14 @@ jobs: fetch-depth: 0 - name: Fail if any existing migration file was modified + env: + # A merge group has no base_ref; it only exposes the base branch as refs/heads/. + BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref }} run: | # List files under go/core/pkg/migrations/ that were changed relative # to the merge base of this PR. We only care about modifications (M) # and renames (R); additions (A) are fine. - BASE=$(git merge-base HEAD origin/${{ github.base_ref }}) + BASE=$(git merge-base HEAD "origin/${BASE_REF#refs/heads/}") MODIFIED=$(git diff --name-only --diff-filter=MR "$BASE" HEAD \ -- 'go/core/pkg/migrations/**/*.sql') diff --git a/.github/workflows/sqlc-generate-check.yaml b/.github/workflows/sqlc-generate-check.yaml index 3a718331c..09f939e38 100644 --- a/.github/workflows/sqlc-generate-check.yaml +++ b/.github/workflows/sqlc-generate-check.yaml @@ -7,6 +7,7 @@ on: - "go/core/internal/database/queries/**" - "go/core/internal/database/sqlc.yaml" - "go/core/pkg/migrations/**" + merge_group: jobs: check: