diff --git a/.github/actions/upgrade-test-setup/action.yaml b/.github/actions/upgrade-test-setup/action.yaml index 4eb4c7f93c..8a3dd0ce34 100644 --- a/.github/actions/upgrade-test-setup/action.yaml +++ b/.github/actions/upgrade-test-setup/action.yaml @@ -30,8 +30,11 @@ runs: - name: Resolve upgrade-from version id: resolve shell: bash + env: + # A merge group has no base_ref; its ref name is gh-readonly-queue//pr-N-. + BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }} run: | - base_ref="${GITHUB_BASE_REF:-${GITHUB_REF_NAME:-}}" + base_ref="${BASE_REF#refs/heads/}" is_release_line=false if [[ "$base_ref" =~ ^release/v[0-9]+\.[0-9]+\.x$ ]]; then is_release_line=true @@ -41,7 +44,7 @@ runs: # prev-stable = the previous minor line's latest published version. # Before that line has a final release, use its latest prerelease so # main keeps upgrade coverage after the release branch is cut. - V="$(./scripts/prev-stable-version.sh)" + V="$(CURRENT_REF="$base_ref" ./scripts/prev-stable-version.sh)" if [ -z "$V" ]; then echo "no published version on the previous release line; skipping prev-stable leg." echo "skip=true" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a8b686ef1..53cc2ac832 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,6 +9,7 @@ on: branches: [main, "release/**"] paths-ignore: - "**/*.md" + merge_group: workflow_dispatch: concurrency: @@ -18,7 +19,8 @@ concurrency: 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 }} # Consistent builder configuration BUILDX_BUILDER_NAME: kagent-builder-v0.23.0 BUILDX_VERSION: v0.23.0 diff --git a/.github/workflows/migration-immutability.yaml b/.github/workflows/migration-immutability.yaml index f18526baf2..11f4e96f1b 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,8 +16,11 @@ 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: | - BASE=$(git merge-base HEAD origin/${{ github.base_ref }}) + BASE=$(git merge-base HEAD "origin/${BASE_REF#refs/heads/}") CHANGED=$(git diff --no-renames --name-status --diff-filter=MDR "$BASE" HEAD \ -- 'go/core/pkg/migrations/**/*.sql' \ | awk '$1 != "D" || $2 !~ /\.(up|down)\.sql$/ { print $2 }') diff --git a/.github/workflows/sqlc-generate-check.yaml b/.github/workflows/sqlc-generate-check.yaml index 4efb50604d..5280ec6932 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: