name: QA Gate (P0/P1) on: pull_request: types: [opened, synchronize, reopened] paths: - "apps/api/**" - "apps/web/**" concurrency: group: qa-gate-${{ github.event.pull_request.number }} cancel-in-progress: true jobs: test-affected: name: Test affected app runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: "pnpm" - run: pnpm install --frozen-lockfile - name: Determine affected app id: affected run: | API_CHANGED=false WEB_CHANGED=false if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -q '^apps/api/'; then API_CHANGED=true fi if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -q '^apps/web/'; then WEB_CHANGED=true fi echo "api_changed=$API_CHANGED" >> $GITHUB_OUTPUT echo "web_changed=$WEB_CHANGED" >> $GITHUB_OUTPUT - name: Run API tests if: steps.affected.outputs.api_changed == 'true' run: pnpm --filter api test - name: Run Web tests if: steps.affected.outputs.web_changed == 'true' run: pnpm --filter web test