From b74fc114e5481bf6fd22a0d7a6c56acb2aa4ee68 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 25 Feb 2026 08:34:19 +0000 Subject: [PATCH] ci: add merge group config --- .github/workflows/ci.yml | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b6bf9a91..42fb26bf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: ci on: + merge_group: push: branches: - main @@ -11,7 +12,39 @@ on: permissions: {} jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + src: ${{ steps.filter.outputs.src }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: filter + with: + base: ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha || github.event.before }} + ref: ${{ github.event.merge_group.head_sha || github.sha }} + filters: | + src: + - 'src/**' + - 'test/**' + - 'scripts/**' + - 'playground/**' + - 'example/**' + - 'pnpm-lock.yaml' + - 'pnpm-workspace.yaml' + - 'package.json' + - 'tsconfig.json' + - 'vitest.config.mts' + - 'build.config.ts' + - 'eslint.config.mjs' + - '.github/workflows/ci.yml' + lint: + needs: changes + if: needs.changes.outputs.src == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -36,6 +69,8 @@ jobs: run: pnpm installed-check -d --no-workspaces ci: + needs: changes + if: needs.changes.outputs.src == 'true' strategy: matrix: os: [ubuntu-latest, windows-latest] @@ -76,3 +111,26 @@ jobs: if: matrix.os != 'windows-latest' env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + ci-ok: + if: always() + runs-on: ubuntu-latest + needs: + - changes + - lint + - ci + steps: + - name: Check required jobs + run: | + results=( \ + "${{ needs.changes.result }}" \ + "${{ needs.lint.result }}" \ + "${{ needs.ci.result }}" \ + ) + for result in "${results[@]}"; do + if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then + echo "One or more required jobs failed or were cancelled: $result" + exit 1 + fi + done + echo "All required jobs passed or were skipped."