diff --git a/.circleci/config.yml b/.circleci/config.yml index ba498cd4d1..689f31fc81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -158,7 +158,12 @@ jobs: - run: name: Run E2E Tests for macOS command: | - pnpm nx affected -t e2e-macos-ci --parallel=1 --base=$NX_BASE --head=$NX_HEAD + HAS_CHANGED=$(node ./scripts/check-react-native-changes.js $NX_BASE $NX_HEAD); + if $HAS_CHANGED; then + pnpm nx affected -t e2e-macos-ci --parallel=1 --base=$NX_BASE --head=$NX_HEAD + else + echo "Skip E2E tests for macOS as there are no changes in React Native projects." + fi no_output_timeout: 45m # ------------------------- diff --git a/scripts/check-react-native-changes.js b/scripts/check-react-native-changes.js new file mode 100644 index 0000000000..5723339bbd --- /dev/null +++ b/scripts/check-react-native-changes.js @@ -0,0 +1,6 @@ +const nxBase = process.argv[2]; +const nxHead = process.argv[3]; +const gitDiffCount = require('child_process').execSync( + `git diff --name-only ${nxBase} ${nxHead} | (grep -E 'packages/detox|packages/react-native|packages/expo|e2e/detox|e2e/react-native|e2e/expo' || true) | wc -l` +); +console.log(parseInt(gitDiffCount.toString()) > 0);