diff --git a/.github/workflows/README.md b/.github/workflows/README.md index caaa06bc597d..aa38a7778f31 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -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. ``` diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 1b794657cfd5..d4c17a734b1c 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -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 }} + - 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 ))" 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" @@ -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 diff --git a/tests/unit/CIGitLogicTest.sh b/tests/unit/CIGitLogicTest.sh index efcedfb06fca..1bb5c88d3427 100755 --- a/tests/unit/CIGitLogicTest.sh +++ b/tests/unit/CIGitLogicTest.sh @@ -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