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
1 change: 0 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ git fetch origin main # This will fetch the full history of the main branch, plu
# Good
git fetch origin main --no-tags --depth=1 # This will just fetch the latest commit from main
git fetch origin tag 1.0.0-0 --no-tags --depth=1 # This will fetch the latest commit from the 1.0.0-0 tag and create a local tag to match
git fetch origin staging --no-tags --shallow-since="$(( $(date +%s) - 3600 ))" # This will fetch all commits made to the staging branch in the last hour
git fetch origin tag 1.0.1-0 --no-tags --shallow-exclude=1.0.0-0 # This will fetch all commits from the 1.0.1-0 tag, except for those that are reachable from the 1.0.0-0 tag.
```

Expand Down
28 changes: 10 additions & 18 deletions .github/workflows/cherryPick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,19 @@ jobs:
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Get previous app version
id: getPreviousVersion
uses: Expensify/App/.github/actions/javascript/getPreviousVersion@main
with:
SEMVER_LEVEL: 'PATCH'

- name: Fetch history of relevant refs
run: |
git fetch origin main staging --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}

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.

This works because all the commits we care about are on main (and we also need history on staging to auto-resolve conflicts in the git cherry-pick command)


- name: Get version bump commit
id: getVersionBumpCommit
run: |
# Find the commit for the version-bump
# This command fetches commits in the last hour on the main branch
git fetch origin main --no-tags --shallow-since="$(( $(date +%s) - 3600 ))"
Comment thread
roryabraham marked this conversation as resolved.
git switch main
VERSION_BUMP_COMMIT="$(git log --format='%H' --author='OSBotify' --grep 'Update version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}')"
echo "VERSION_BUMP_SHA=$VERSION_BUMP_COMMIT" >> "$GITHUB_OUTPUT"
Expand All @@ -61,21 +68,6 @@ jobs:
USER: ${{ github.actor }}
PULL_REQUEST_NUMBER: ${{ github.event.inputs.PULL_REQUEST_NUMBER }}

- name: Get previous app version
id: getPreviousVersion
uses: Expensify/App/.github/actions/javascript/getPreviousVersion@main
with:
SEMVER_LEVEL: 'PATCH'

- name: Fetch history of relevant refs
run: |
git fetch origin \
staging \
${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }} \
${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }} \
--no-tags \
--shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}

- name: Cherry-pick the version-bump to staging
run: |
git switch staging
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/CIGitLogicTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function cherry_pick_pr {
checkout_repo
setup_git_as_osbotify
PREVIOUS_PATCH_VERSION="$(node "$getPreviousVersion" "$(print_version)" "$SEMVER_LEVEL_PATCH")"
git fetch origin staging "$VERSION_BUMP_COMMIT" "$PR_MERGE_COMMIT" --no-tags --shallow-exclude="$PREVIOUS_PATCH_VERSION"
git fetch origin main staging --no-tags --shallow-exclude="$PREVIOUS_PATCH_VERSION"

git switch staging
git switch -c cherry-pick-staging
Expand Down