Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/cherryPick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ on:
type: string
required: true

concurrency:
group: "cherrypick"
cancel-in-progress: false

jobs:
createNewVersion:
uses: ./.github/workflows/createNewVersion.yml
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/createNewVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,21 @@ jobs:
- name: Commit new Mobile-Expensify version
working-directory: Mobile-Expensify
run: |
# Checkout main branch in Mobile-Expensify submodule.
# This is IMPORTANT so that when we make changes, we aren't in a detached head state, and when we later push those changes to main, it works!
git checkout main
# First commit the version changes on detached HEAD
git add \
./Android/AndroidManifest.xml \
./app/config/config.json \
./iOS/Expensify/Expensify-Info.plist\
./iOS/SmartScanExtension/Info.plist \
./iOS/NotificationServiceExtension/Info.plist
git commit -m "Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }}"

# Store the commit hash before checkout to ensure we cherry-pick the right commit
DETACHED_COMMIT=$(git rev-parse HEAD)

# Cherry-pick the version bump commit onto main, to safely handle case where new commits exist on main
git checkout main && git pull origin main
git cherry-pick "$DETACHED_COMMIT"
if ! git push origin main; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the git push going to fail now, because we'll have made a commit on an outdated version of main?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, you mean because we haven't refetched main? I think you're correct

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding git pull origin main should resolve that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Let me know if I missunderstood your comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's what I meant 👍

echo "Race condition! Mobile-Expensify main was updated while this workflow was running, so push failed. Fetching remote, rebasing, and retrying push once."
git fetch origin main
Expand Down
Loading