run-pr-e2e
Skill2 starsChanged 3 months agoMITView on GitHub
Android E2E for a PR using the CI-built APK (no local build). Verifies the bit-identical artifact that would ship. Defers to /run-e2e for everything generic.
- Reads credentials
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- benchSkill
- figma-implementSkill
- memory-profileSkill
- review-l10nSkill
- review-prSkill
- run-e2eSkill
- start-taskSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 33
Always a fresh ./worktrees/PR-<N>-e2e on detached origin/<head-branch> — the exact commit CI built.
- Very specific: line 35
Never reuse an in-flight PR-<N> fix worktree (APK-vs-specs drift — the fix worktree may have uncommitted changes the CI APK doesn't know …
- Very specific: line 36
If PR-<N>-e2e already exists from a prior run, fast-forward it to current origin/<branch>.
- Very specific: line 41
Default is every *.spec.ts minus visual-capture, diagnostic, memory-profile:
- Very specific: line 91
Add --e2e if any spec in the list drives the automation bridge (memory-snapshot / bench-runner / AUTOMATION_BRIDGE).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Run PR E2E (CI APK)
This skill covers ONLY what's different from /run-e2e. For pre-flight (sim/emu booted, devices.json drift, port-4723 cleanup), reports, and failure-mode lookup — read /run-e2e. Do not duplicate.
When to use this vs /run-e2e
| You want | Use |
| Test local changes you're iterating on | /run-e2e |
| Verify a PR with the EXACT artifact that would ship (no local build divergence) | /run-pr-e2e |
| Run iOS E2E for a PR | /run-e2e (iOS CI doesn't publish a reusable sim build — you have to build from source) |
This skill is Android only. iOS is out of scope at the CI-artifact level.
What's different from /run-e2e
Four things. Everything else is the same and lives in /run-e2e.
1. Where the APK comes from
- Default (prod APK from
ci.yml).tools/run-pr-e2e.shcallstools/fetch-pr-apk.sh, which finds the newest completedci.ymlpull_requestrun for the PR, downloadsandroid-release-apk, and drops it at<worktree>/android/app/build/outputs/apk/release/app-release.apk. This APK is bridge-stripped — specs that drive thesrc/__automation__/bridge (memory-snapshot, bench-runner) silently no-op. --e2eflag (bridge-enabled APK frome2e-tests.yml). Required for bridge-driven specs.e2e-tests.ymlisworkflow_dispatch-only and matched by head branch — someone must have dispatched it for this PR's branch first, otherwise fetch fails with "no completed workflow_dispatch run found for branch".
2. Worktree contract
Always a fresh ./worktrees/PR-<N>-e2e on detached origin/<head-branch> — the exact commit CI built. Rules:
- Never reuse an in-flight
PR-<N>fix worktree (APK-vs-specs drift — the fix worktree may have uncommitted changes the CI APK doesn't know about). - If
PR-<N>-e2ealready exists from a prior run, fast-forward it to currentorigin/<branch>; don't create a parallel one. ./tools/create-worktree.sh PR-<N>-e2e --detach --ref origin/<branch>already syncse2e/devices.json,.env, keystores. For an existing worktree refresh via./tools/sync-worktree-config.sh "$WORKTREE".
3. Spec selection
Default is every *.spec.ts minus visual-capture, diagnostic, memory-profile:
visual-capture— screenshot generation driven by story files, not a regression.diagnostic— device-state inspector, not a regression.memory-profile— has its own pipeline (/memory-profile); needs device-specific baselines to be meaningful.
Enumerate dynamically so new specs on the PR are picked up:
EXCLUDE='^(visual-capture|diagnostic|memory-profile)$'
SPECS=$(find "$WORKTREE/e2e/specs" -type f -name '*.spec.ts' \
| sed -E 's#.*/##; s#\.spec\.ts$##' | grep -vE "$EXCLUDE" \
| sort -u | paste -sd, -)4. The entry point is tools/run-pr-e2e.sh, not the runner directly
It's a thin wrapper around scripts/run-e2e.ts --skip-build. It handles APK fetch + placement, then loops --specs invocations against the runner. Don't replicate its work by calling the runner directly — you'll re-download the APK or fight the wrapper.
Run
From the dev-team repo root:
PR=<number>
PR_BRANCH=$(gh pr view "$PR" --repo a-ghorbani/pocketpal-ai --json headRefName -q .headRefName)
# Create or fast-forward the e2e worktree
cd ./repos/pocketpal-ai && git fetch origin "$PR_BRANCH" && cd -
if [ -d "./worktrees/PR-${PR}-e2e" ]; then
git -C "./worktrees/PR-${PR}-e2e" reset --hard "origin/$PR_BRANCH"
./tools/sync-worktree-config.sh "./worktrees/PR-${PR}-e2e"
else
./tools/create-worktree.sh "PR-${PR}-e2e" --detach --ref "origin/$PR_BRANCH"
fi
WORKTREE="./worktrees/PR-${PR}-e2e"
cd "$WORKTREE" && yarn install && (cd e2e && yarn install) && cd -
# Pre-flight: see /run-e2e Step 1 (sim/emu booted, port 4723, devices.json appPath).
SPECS=$(find "$WORKTREE/e2e/specs" -type f -name '*.spec.ts' \
| sed -E 's#.*/##; s#\.spec\.ts$##' \
| grep -vE '^(visual-capture|diagnostic|memory-profile)$' \
| sort -u | paste -sd, -)
POCKETPAL_REPO="$(realpath "$WORKTREE")" \
bash ./tools/run-pr-e2e.sh "$PR" [--e2e] --specs "$SPECS" -- --devices connectedAdd --e2e if any spec in the list drives the automation bridge (memory-snapshot / bench-runner / AUTOMATION_BRIDGE).
Inputs that ONLY exist here (not in /run-e2e)
| Flag | Purpose |
--e2e | Fetch bridge-enabled APK from e2e-tests.yml (manual dispatch required) instead of prod APK from ci.yml |
--no-fetch | Skip APK download; reuse an already-installed APK on the device |
--specs a,b,c | Comma-separated list (one wrapper invocation per spec, sequentially) |
Everything after -- is passed verbatim to scripts/run-e2e.ts (devices filter, dry-run, etc.).
PR-specific failure modes (everything else: see /run-e2e)
| Symptom | Fix |
no completed CI runs found for PR #N | PR's ci.yml is still running or failed. gh run watch or pick another run. |
artifact 'android-release-apk' not found | The Android build job failed in that run. gh run view <id>. |
(--e2e) no completed e2e-tests.yml workflow_dispatch run found for branch | e2e-tests.yml was never dispatched for this PR's branch. Dispatch it (select the PR's head branch as the workflow ref), wait, then rerun. |
(--e2e) artifact 'e2e-android-apk' not found | E2E build job failed in that dispatch. gh run view <id>. |
Required env
GITHUB_TOKENorGH_TOKEN(for artifact download)ANDROID_HOMEorANDROID_SDK_ROOT
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

