Skip to content

Commit

Permalink
Merge pull request #22758 from Expensify/Rory-CPWorksAfterAnHOur
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl authored Jul 12, 2023
2 parents 60d8edb + c3a33f2 commit 5e7cef6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
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 }}
- 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"
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

0 comments on commit 5e7cef6

Please sign in to comment.