From c8f9f216aabaaa57590aaebd521a88d50c36d51c Mon Sep 17 00:00:00 2001 From: Sidharth Menon Date: Sat, 10 Oct 2026 15:01:04 -0700 Subject: [PATCH] fix(ci): report desktop check for diffr-only changes Agent-Session: 8881e3f3-a916-4405-9706-bb6e3a2f193d Agent-Session: 01a127c4-196c-7472-a943-6cb22a2f1c4a Agent-Session: 01a127c7-65e6-7990-92ae-58fbb2927383 --- .github/workflows/review-desktop-ci.yml | 62 +++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/.github/workflows/review-desktop-ci.yml b/.github/workflows/review-desktop-ci.yml index d98c04268..9945a973e 100644 --- a/.github/workflows/review-desktop-ci.yml +++ b/.github/workflows/review-desktop-ci.yml @@ -7,8 +7,6 @@ on: - reopened - synchronize - ready_for_review - paths-ignore: - - "diffr/**" workflow_dispatch: permissions: @@ -19,8 +17,43 @@ concurrency: cancel-in-progress: true jobs: - review-desktop: - name: Review Desktop + changes: + name: Detect desktop changes + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + desktop: ${{ steps.changes.outputs.desktop }} + steps: + - name: Checkout + if: github.event_name == 'pull_request' + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + fetch-depth: 0 + + - name: Detect changes outside diffr + id: changes + env: + EVENT_NAME: ${{ github.event_name }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + if [[ "$EVENT_NAME" != pull_request ]]; then + echo "desktop=true" >> "$GITHUB_OUTPUT" + elif git diff --quiet --no-renames "$BASE_SHA...$HEAD_SHA" -- . ':(exclude)diffr/**'; then + echo "desktop=false" >> "$GITHUB_OUTPUT" + else + status=$? + # A diff exits 1 for changes; other failures must not skip CI. + if [[ "$status" -ne 1 ]]; then + exit "$status" + fi + echo "desktop=true" >> "$GITHUB_OUTPUT" + fi + + desktop-build: + name: Build and test desktop + needs: changes + if: needs.changes.outputs.desktop == 'true' runs-on: ubuntu-latest timeout-minutes: 60 @@ -172,3 +205,24 @@ jobs: packages/review/**/__screenshots__ packages/review/**/__traces__ if-no-files-found: ignore + + # Keep the required check present even when diffr-only PRs skip the build. + review-desktop: + name: Review Desktop + needs: [changes, desktop-build] + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Check desktop CI result + env: + CHANGES_RESULT: ${{ needs.changes.result }} + DESKTOP_REQUIRED: ${{ needs.changes.outputs.desktop }} + BUILD_RESULT: ${{ needs.desktop-build.result }} + run: | + [[ "$CHANGES_RESULT" == success ]] || exit 1 + if [[ "$DESKTOP_REQUIRED" == false && "$BUILD_RESULT" == skipped ]]; then + echo "Desktop CI is not required for diffr-only changes." + else + [[ "$DESKTOP_REQUIRED" == true && "$BUILD_RESULT" == success ]] + fi