Open History to see the last commit
1name: Mobile Fingerprint Check
2β
3# Detects whether a PR changes the native fingerprint β i.e. whether merging
4# it would leave main un-OTA-able until a new store build ships. Native-change
5# PRs get the "π± Native Change" label so they can be held and merged as a
6# batch right before the next store submission, keeping main OTA-able for
7# everything else in between. (Once one native PR merges, every later merge
8# inherits the drifted fingerprint and loses OTA reach too β that is why the
9# signal has to fire before merge, not after.)
10#
11# The check is advisory: it always passes, the label is the signal. Both
12# fingerprints are computed in this one job (same OS, same corepack-pinned
13# pnpm), so the comparison is self-consistent; no EXPO_TOKEN needed.
14on:
15 pull_request:
16 paths:
17 - apps/mobile/**
18 - packages/client-runtime/**
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β
28concurrency:
29 group: mobile-fingerprint-check-${{ github.event.pull_request.number }}
30 cancel-in-progress: true
31β
32jobs:
33 fingerprint:
34 name: Native fingerprint diff
35 runs-on: blacksmith-8vcpu-ubuntu-2404
36 permissions:
37 contents: read
38 issues: write
39 pull-requests: write
40 env:
41 APP_VARIANT: production
42 NODE_OPTIONS: --max-old-space-size=8192
43 steps:
44 - name: Checkout
45 uses: actions/checkout@v6
46 with:
47 # Default pull_request checkout is the merge commit (PR applied on
48 # top of base), so the "head" fingerprint is the state main would
49 # actually be in after merging β stale branches compare cleanly.
50 fetch-depth: 0
51β
52 - name: Setup Vite+
53 uses: voidzero-dev/setup-vp@v1
54 with:
55 node-version-file: package.json
56 cache: true
57 run-install: |
58 args:
59 - --filter=@t3tools/mobile...
60β
61 - name: Expose pnpm
62 run: |
63 pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")"
64 vp_pnpm_bin="$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin"
65 echo "$vp_pnpm_bin" >> "$GITHUB_PATH"
66 "$vp_pnpm_bin/pnpm" --version
67β
68 - name: Fingerprint merge result
69 working-directory: apps/mobile
70 run: |
71 mkdir -p "$RUNNER_TEMP/fp/head" "$RUNNER_TEMP/fp/base"
72 for platform in ios android; do
73 npx expo-updates fingerprint:generate --platform "$platform" > "$RUNNER_TEMP/fp/head/$platform.json"
74 done
75β
76 - name: Fingerprint base
77 run: |
78 git checkout --quiet "${{ github.event.pull_request.base.sha }}"
79 # Re-sync node_modules to the base commit's lockfile before
80 # fingerprinting β a dep-changing PR must not fingerprint the base
81 # against head's installed packages.
82 pnpm install --filter=@t3tools/mobile...
83 cd apps/mobile
84 for platform in ios android; do
85 npx expo-updates fingerprint:generate --platform "$platform" > "$RUNNER_TEMP/fp/base/$platform.json"
86 done
87β
88 - id: compare
89 name: Compare fingerprints
90 run: |
91 changed=""
92 {
93 echo "## Native fingerprint diff"
94 echo
95 for platform in ios android; do
96 head_hash="$(jq -r .hash "$RUNNER_TEMP/fp/head/$platform.json")"
97 base_hash="$(jq -r .hash "$RUNNER_TEMP/fp/base/$platform.json")"
98 if [ "$head_hash" = "$base_hash" ]; then
99 echo "- β
**$platform**: unchanged (\`$head_hash\`) β OTA-compatible"
100 continue
101 fi
102 changed="$changed $platform"
103 echo "- π± **$platform**: \`$base_hash\` β \`$head_hash\` β merging requires a new native build before OTAs work again"
104 jq -r -n \
105 --slurpfile h "$RUNNER_TEMP/fp/head/$platform.json" \
106 --slurpfile b "$RUNNER_TEMP/fp/base/$platform.json" '
107 ($b[0].sources | map({ (.filePath // .id): .hash }) | add // {}) as $bm
108 | $h[0].sources[]
109 | select($bm[(.filePath // .id)] != .hash)
110 | " - \(.type): `\(.filePath // .id)`"'
111 done
112 } >> "$GITHUB_STEP_SUMMARY"
113 echo "changed_platforms=${changed# }" >> "$GITHUB_OUTPUT"
114β
115 - name: Sync native change label
116 # Fork PRs get a read-only token under pull_request; the check stays
117 # advisory there (summary only). This workflow must not move to
118 # pull_request_target β it installs and runs PR code.
119 if: github.event.pull_request.head.repo.full_name == github.repository
120 uses: actions/github-script@v8
121 env:
122 CHANGED_PLATFORMS: ${{ steps.compare.outputs.changed_platforms }}
123 with:
124 script: |
125 const managedLabel = {
126 name: "π± Native Change",
127 color: "d93f0b",
128 description:
129 "Changes the native fingerprint; merging blocks production OTAs until a new store build ships.",
130 };
131 const nativeChanged = (process.env.CHANGED_PLATFORMS ?? "").trim() !== "";
132 const issueNumber = context.payload.pull_request.number;
133β
134 try {
135 const { data: existing } = await github.rest.issues.getLabel({
136 owner: context.repo.owner,
137 repo: context.repo.repo,
138 name: managedLabel.name,
139 });
140β
141 if (
142 existing.color !== managedLabel.color ||
143 (existing.description ?? "") !== managedLabel.description
144 ) {
145 await github.rest.issues.updateLabel({
146 owner: context.repo.owner,
147 repo: context.repo.repo,
148 name: managedLabel.name,
149 color: managedLabel.color,
150 description: managedLabel.description,
151 });
152 }
153 } catch (error) {
154 if (error.status !== 404) {
155 throw error;
156 }
157β
158 try {
159 await github.rest.issues.createLabel({
160 owner: context.repo.owner,
161 repo: context.repo.repo,
162 name: managedLabel.name,
163 color: managedLabel.color,
164 description: managedLabel.description,
165 });
166 } catch (createError) {
167 if (createError.status !== 422) {
168 throw createError;
169 }
170 }
171 }
172β
173 const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
174 owner: context.repo.owner,
175 repo: context.repo.repo,
176 issue_number: issueNumber,
177 per_page: 100,
178 });
179 const hasLabel = currentLabels.some((label) => label.name === managedLabel.name);
180β
181 if (nativeChanged && !hasLabel) {
182 await github.rest.issues.addLabels({
183 owner: context.repo.owner,
184 repo: context.repo.repo,
185 issue_number: issueNumber,
186 labels: [managedLabel.name],
187 });
188 } else if (!nativeChanged && hasLabel) {
189 try {
190 await github.rest.issues.removeLabel({
191 owner: context.repo.owner,
192 repo: context.repo.repo,
193 issue_number: issueNumber,
194 name: managedLabel.name,
195 });
196 } catch (removeError) {
197 if (removeError.status !== 404) {
198 throw removeError;
199 }
200 }
201 }
202β
203 core.info(
204 `PR #${issueNumber}: native fingerprint ${nativeChanged ? `changed (${process.env.CHANGED_PLATFORMS})` : "unchanged"}`,
205 );