Repository navigation
Extract syncVersions workflow shell into a script - #97598
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Refactors the manual syncVersions GitHub Actions workflow by extracting its bash logic into a dedicated script, keeping the workflow YAML focused on orchestration (dispatch/checkout/actor validation/git+node setup) while preserving the existing sync behavior and outputs.
Changes:
- Moved the version/submodule sync logic from
.github/workflows/syncVersions.ymlinto.github/scripts/syncVersions.shwithcheck,sync, andversion-componentssubcommands. - Added a Jest unit test suite that exercises the script against temporary git repo fixtures, including macOS-only coverage for iOS/Android file rewrites.
- Updated the Jest workflow path filters to run when
.shfiles change.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/unit/SyncVersionsTest.ts |
Adds unit/integration-style tests that execute the real script against temp git repos and validate outputs and side effects. |
.github/workflows/test.yml |
Triggers Jest workflow on *.sh changes so script changes run tests in CI. |
.github/workflows/syncVersions.yml |
Replaces inline shell logic with thin invocations of the new script and threads required env/outputs. |
.github/scripts/syncVersions.sh |
Introduces the extracted, subcommand-based bash implementation of the sync workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review — looks solid ✅This is a faithful, behavior-preserving refactor. I diffed the extracted I did not approve (I don't auto-approve), but I found no correctness regressions. One thing worth being aware of before merge: The full-version-sync path — the riskiest path — isn't covered in CI. The three Parity spot-checks & minor notes
All required checks are green. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Thanks — both of your notes are addressed in 1. The full-version-sync path had no CI coverage. You were right that this was the meaningful gap: the riskiest branch was validated only by running It's path-gated to 2. The I also piped stderr in the fixture's On the deferred |
|
@MelvinBot can you sync up with main? |
Co-authored-by: Vit Horacek <mountiny@users.noreply.github.com>
|
🤖 Synced with No conflicts. The branch is now 0 commits behind
The PR is |
tests/tooling is where tests for .github/ and scripts/ live, and bunTests.yml already triggers on .github/scripts/**. Jest explicitly ignores that directory.
bun only resolves from node_modules/.bin, which npm run puts on PATH but a plain run step does not. Every other workflow that calls bun directly uses npx.
|
@Eskalifer1 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Review — no correctness regressions ✅Since my last pass at Three things to fix or decide before merge — none of them block the refactor itself. 1. The test plan points at a file that no longer existsThe tests moved to
and step 3 says "The main Jest job runs on Ubuntu" and "path-gated to … TZ=utc bun test --parallel --preload ./scripts/stubReactNative.js --preload ./tests/tooling/setup.ts ./tests/tooling/SyncVersions.test.tsThe job that skips the three macOS tests on Ubuntu is now Bun tests, not Jest. 2. Both rebase-retry paths are still untestedThe 3. The path filter will silently stop running the macOS-only tests
Verification notes
I did not approve; I don't auto-approve. The remaining red check is |
The rebase fallbacks are the most intricate code in the script and nothing reached them. Pushing an unrelated commit to the App remote between check and sync makes the first push non fast-forward and drives both. The macOS job is gated on this file by name, so a rename would stop it triggering and the full version sync cases would skip on Ubuntu with nothing failing. The last test asserts the workflow still names this file.
|
(Vit's agent) All three addressed in 1. Test plan pointed at a file that no longer exists. Fixed in the body. Step 2 now carries the 2. Both rebase-retry paths are now covered. One test per path, each pushing an unrelated commit to the App bare remote between 3. The path filter trap — fixed differently, and I think better. A glob still breaks on a real rename, so instead the suite's last test asserts that One correction to the premise of #3: a rename would not have produced a silent pass at the run step. On sequencing: agreed, and you're right that #97599 is still a draft. It is |
|
@codex review |
Re-review of
|
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…comments The checkout is pinned to main, so extracting the logic into a script meant a change to it could not run until it had already landed. Dispatching from a branch now reads the script from that branch. The comments carried over from the inline YAML only restated the command underneath them.
lakchote
left a comment
There was a problem hiding this comment.
Left 2 NAB comments see https://github.com/Expensify/Style-Guides/blob/main/general.md#comments for reference
Co-authored-by: Lucien Akchoté <lucien@expensify.com>
Co-authored-by: Lucien Akchoté <lucien@expensify.com>
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/lakchote in version: 9.4.95-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.95-4 🚀
|
Explanation of Change
Follow-up to the review feedback on Fix version sync between E/App and Mobile-Expensify: the main shell logic is moved out of
.github/workflows/syncVersions.ymland into.github/scripts/syncVersions.sh, leaving the workflow responsible only forworkflow_dispatch, checkout,validateActor,setupGitForOSBotify,setupNode, and thinrun:invocations.This is a behavior-preserving refactor. Every annotation string, commit message and git invocation is carried over unchanged.
Six
run:-bearing steps collapse into two:submoduleRemote,checkVersions./.github/scripts/syncVersions.sh checktargetVersion, full version sync, submodule-only bump,verifySync./.github/scripts/syncVersions.sh syncThe script uses two subcommands rather than a single always-run step so that
setupNodecan stay conditional — it is only needed for the full version sync path, and on macOS it runsnpm ci(which also runsnpm iinsideMobile-Expensifyviascripts/postInstall.sh, dirtying the submodule working tree). Forcing it on the submodule-only path would be both slow and a new failure mode.Notes on the details that matter for parity:
ACTUAL_SHAandNEED_FULL_VERSION_SYNCare threaded fromchecktosyncthrough step outputs rather than recomputed. RecomputingACTUAL_SHAwould turn the "did the submodule checkout move since we updated it?" guard into a comparison of a value with itself.syncdeliberately never re-runsgit submodule update --remote— Mobile-Expensifymaincan advance while Node is being set up between the two steps.git diff --staged --quiet; the full-sync path does none of that).${{ }}expression is interpolated into a shell body any more.TARGET_VERSIONand the resolved script path reach the shell viaenv:, which removes a script-injection vector on a runner that holdsOS_BOTIFY_COMMIT_TOKENand 1Password credentials.ref: main, so moving the logic out of the YAML would have made the script untestable before merge: dispatching from a branch reads this file from the branch but still checks outmain's copy of the script, which does not exist yet. AResolve the script to runstep restores that, reading the script from the dispatched ref into$RUNNER_TEMPwhen it is notmain. It goes to a temp file rather than over the working tree, which has to stay clean for the rebase in the push retry path.The script gains one extra subcommand,
version-components, purely so the Android/iOS version math can be unit tested without a repo fixture.Two follow-ups intentionally left out of this PR so it stays a pure refactor:
git add Mobile-Expensify; git commitunconditionally. When the versions differ but the App gitlink already points at Mobile-Expensifymain, nothing is staged,git commitexits 1, and the job dies after the local version commit and before any push. The submodule-only path already guards this withgit diff --staged --quiet. Fixed in a follow-up PR stacked on this one.TARGET_VERSIONdispatch input is only usable when it equals the Mobile-Expensify version, since only the App side is rewritten and verification then compares the two. The inputdescription:is clarified here; the behavior is unchanged.Fixed Issues
$ #88233
PROPOSAL: N/A
Tests
This is a CI-only workflow change; there is no app-facing behavior to exercise. It is covered by new unit tests plus ShellCheck.
Run
npm run shellcheckand verify it passes for all files, including the new.github/scripts/syncVersions.sh.Run the suite on macOS and verify all 16 tests pass. It lives in
tests/tooling/, which is where tests for.github/andscripts/belong, and runs underbun testrather than Jest:TZ=utc bun test --parallel --preload ./scripts/stubReactNative.js --preload ./tests/tooling/setup.ts ./tests/tooling/SyncVersions.test.tsIt builds throwaway git repos (a bare Mobile-Expensify remote, a bare App remote, and a working clone wiring them together as a submodule) under
os.tmpdir()and runs the real script against them:version-componentsderives the correctSHORT_VERSION/BUILD_NUMBER/CF_VERSION/ANDROID_VERSION_CODE, including zero-padding, matchinggenerateAndroidVersionCodeinscripts/bumpVersion.ts.checkreports in-sync, full-version-sync-needed, and submodule-bump-needed for the three real-world states.syncin submodule-only mode commits and pushes the new pointer and verifies it, and fails with::error::(without pushing) when the submodule checkout moved sincecheck.syncin full-version mode rewritespackage.json,android/app/build.gradleand all threeInfo.plistfiles, pushes both commits, and fails verification when the target version does not match Mobile-Expensify.checkandsync, so the first push is not a fast-forward.Verify that the four full-version-sync tests are skipped on Linux (they depend on
PlistBuddyand BSDsed -i '') and run on macOS. TheBun testsjob runs on Ubuntu, so those four would otherwise never run in CI —.github/workflows/testSyncVersions.ymlruns the same suite on a macOS runner instead. It is path-gated to.github/scripts/syncVersions.shandtests/tooling/SyncVersions.test.ts, so it only spends a macOS runner when this script or its tests change. Verify that job is green on this PR and that its log shows all 16 tests running with none skipped.pathsfilter and therunstep. It runs on Ubuntu too, viaBun tests.Confirm the rendered workflow file still contains the same step order: checkout →
validateActor→setupGitForOSBotify→check→ conditionalsetupNode→sync→ Slack announce → Slack failure.Deployer validation: trigger the
Sync E/App and Mobile-Expensify versionsworkflow manually from this branch, while App and Mobile-Expensify are already in sync. Verify theResolve the script to runstep logs::warning::Running syncVersions.sh from vit-syncVersions-script rather than main, and that the run then exits early with::notice::✅ Versions and submodule are in sync, making no commits, no pushes and no Slack post.Offline tests
Not applicable — this changes a GitHub Actions workflow and its supporting script. There is no client-side behavior and no network state to vary.
QA Steps
Not applicable — no user-facing behavior changes. The workflow is a manual
workflow_dispatchrestricted to mobile deployers and is validated by triggering it directly (see step 5 inTests), not on staging or production.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Not yet tested — needs manual QA.
Android: mWeb Chrome
Not yet tested — needs manual QA.
iOS: Native
Not yet tested — needs manual QA.
iOS: mWeb Safari
Not yet tested — needs manual QA.
MacOS: Chrome / Safari
Not yet tested — needs manual QA.