| ... | @@ -13,17 +13,9 @@ name: Mobile Fingerprint Check | ... | @@ -13,17 +13,9 @@ name: Mobile Fingerprint Check |
| 13 | # pnpm), so the comparison is self-consistent; no EXPO_TOKEN needed. | 13 | # pnpm), so the comparison is self-consistent; no EXPO_TOKEN needed. |
| 14 | on: | 14 | on: |
| 15 | pull_request: | 15 | pull_request: |
| 16 | paths: | 16 | # Run even when a rebase or base change removes every native input from the |
| 17 | - apps/mobile/** | 17 | # diff, so the label can be cleared without installing Expo dependencies. |
| 18 | - packages/client-runtime/** | 18 | types: [opened, synchronize, reopened, edited] |
| 19 | - packages/contracts/** | | |
| 20 | - packages/shared/** | | |
| 21 | - assets/** | | |
| 22 | - scripts/** | | |
| 23 | - patches/** | | |
| 24 | - pnpm-lock.yaml | | |
| 25 | - pnpm-workspace.yaml | | |
| 26 | - .github/workflows/mobile-fingerprint-check.yml | | |
| 27 | | 19 | |
| 28 | concurrency: | 20 | concurrency: |
| 29 | group: mobile-fingerprint-check-${{ github.event.pull_request.number }} | 21 | group: mobile-fingerprint-check-${{ github.event.pull_request.number }} |
| ... | @@ -44,12 +36,29 @@ jobs: | ... | @@ -44,12 +36,29 @@ jobs: |
| 44 | - name: Checkout | 36 | - name: Checkout |
| 45 | uses: actions/checkout@v6 | 37 | uses: actions/checkout@v6 |
| 46 | with: | 38 | with: |
| 47 | # Default pull_request checkout is the merge commit (PR applied on | 39 | # The merge ref can advance after the event is queued. Pin its commit |
| 48 | # top of base), so the "head" fingerprint is the state main would | 40 | # and compare against its first parent, rather than the event's base. |
| 49 | # actually be in after merging — stale branches compare cleanly. | 41 | ref: ${{ github.sha }} |
| 50 | fetch-depth: 0 | 42 | fetch-depth: 2 |
| | 43 | |
| | 44 | - id: changes |
| | 45 | name: Detect native fingerprint inputs |
| | 46 | run: | |
| | 47 | base_sha=$(git rev-parse HEAD^1) |
| | 48 | echo "base_sha=$base_sha" >> "$GITHUB_OUTPUT" |
| | 49 | paths=$(git diff --no-renames --name-only "$base_sha" HEAD -- \ |
| | 50 | apps/mobile/ packages/client-runtime/ packages/contracts/ packages/shared/ \ |
| | 51 | assets/ scripts/ patches/ package.json pnpm-lock.yaml pnpm-workspace.yaml \ |
| | 52 | .github/workflows/mobile-fingerprint-check.yml) |
| | 53 | if [[ -n "$paths" ]]; then |
| | 54 | echo "relevant=true" >> "$GITHUB_OUTPUT" |
| | 55 | else |
| | 56 | echo "relevant=false" >> "$GITHUB_OUTPUT" |
| | 57 | echo "No native fingerprint inputs changed; clearing any stale native change label." >> "$GITHUB_STEP_SUMMARY" |
| | 58 | fi |
| 51 | | 59 | |
| 52 | - name: Setup Vite+ | 60 | - name: Setup Vite+ |
| | 61 | if: steps.changes.outputs.relevant == 'true' |
| 53 | uses: voidzero-dev/setup-vp@v1 | 62 | uses: voidzero-dev/setup-vp@v1 |
| 54 | with: | 63 | with: |
| 55 | node-version-file: package.json | 64 | node-version-file: package.json |
| ... | @@ -59,6 +68,7 @@ jobs: | ... | @@ -59,6 +68,7 @@ jobs: |
| 59 | - --filter=@t3tools/mobile... | 68 | - --filter=@t3tools/mobile... |
| 60 | | 69 | |
| 61 | - name: Expose pnpm | 70 | - name: Expose pnpm |
| | 71 | if: steps.changes.outputs.relevant == 'true' |
| 62 | run: | | 72 | run: | |
| 63 | pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")" | 73 | pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")" |
| 64 | vp_pnpm_bin="$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin" | 74 | vp_pnpm_bin="$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin" |
| ... | @@ -66,6 +76,7 @@ jobs: | ... | @@ -66,6 +76,7 @@ jobs: |
| 66 | "$vp_pnpm_bin/pnpm" --version | 76 | "$vp_pnpm_bin/pnpm" --version |
| 67 | | 77 | |
| 68 | - name: Fingerprint merge result | 78 | - name: Fingerprint merge result |
| | 79 | if: steps.changes.outputs.relevant == 'true' |
| 69 | working-directory: apps/mobile | 80 | working-directory: apps/mobile |
| 70 | run: | | 81 | run: | |
| 71 | mkdir -p "$RUNNER_TEMP/fp/head" "$RUNNER_TEMP/fp/base" | 82 | mkdir -p "$RUNNER_TEMP/fp/head" "$RUNNER_TEMP/fp/base" |
| ... | @@ -74,8 +85,11 @@ jobs: | ... | @@ -74,8 +85,11 @@ jobs: |
| 74 | done | 85 | done |
| 75 | | 86 | |
| 76 | - name: Fingerprint base | 87 | - name: Fingerprint base |
| | 88 | if: steps.changes.outputs.relevant == 'true' |
| | 89 | env: |
| | 90 | BASE_SHA: ${{ steps.changes.outputs.base_sha }} |
| 77 | run: | | 91 | run: | |
| 78 | git checkout --quiet "${{ github.event.pull_request.base.sha }}" | 92 | git checkout --quiet "$BASE_SHA" |
| 79 | # Re-sync node_modules to the base commit's lockfile before | 93 | # Re-sync node_modules to the base commit's lockfile before |
| 80 | # fingerprinting — a dep-changing PR must not fingerprint the base | 94 | # fingerprinting — a dep-changing PR must not fingerprint the base |
| 81 | # against head's installed packages. | 95 | # against head's installed packages. |
| ... | @@ -87,6 +101,7 @@ jobs: | ... | @@ -87,6 +101,7 @@ jobs: |
| 87 | | 101 | |
| 88 | - id: compare | 102 | - id: compare |
| 89 | name: Compare fingerprints | 103 | name: Compare fingerprints |
| | 104 | if: steps.changes.outputs.relevant == 'true' |
| 90 | run: | | 105 | run: | |
| 91 | changed="" | 106 | changed="" |
| 92 | { | 107 | { |