@@ -43,34 +43,47 @@ jobs:
43
43
with :
44
44
GPG_PASSPHRASE : ${{ secrets.LARGE_SECRET_PASSPHRASE }}
45
45
46
- - name : Get merge commit for CP pull request
46
+ - name : Get version bump commit
47
+ id : getVersionBumpCommit
48
+ run : |
49
+ # Find the commit for the version-bump
50
+ # This command fetches commits in the last hour on the main branch
51
+ git fetch origin main --no-tags --shallow-since="$(( $(date +%s) - 3600 ))"
52
+ git switch main
53
+ VERSION_BUMP_COMMIT="$(git log --format='%H' --author='OSBotify' --grep 'Update version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}')"
54
+ echo "VERSION_BUMP_SHA=$VERSION_BUMP_COMMIT" >> "$GITHUB_OUTPUT"
55
+
56
+ - name : Get merge commit for pull request to CP
47
57
id : getCPMergeCommit
48
58
uses : Expensify/App/.github/actions/javascript/getPullRequestDetails@main
49
59
with :
50
60
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51
61
USER : ${{ github.actor }}
52
62
PULL_REQUEST_NUMBER : ${{ github.event.inputs.PULL_REQUEST_NUMBER }}
53
63
54
- - name : Cherry-pick the version-bump to staging
64
+ - name : Get previous app version
65
+ id : getPreviousVersion
66
+ uses : Expensify/App/.github/actions/javascript/getPreviousVersion@main
67
+ with :
68
+ SEMVER_LEVEL : ' PATCH'
69
+
70
+ - name : Fetch history of relevant refs
55
71
run : |
56
- # Find the commit for the version-bump
57
- # This command fetches commits in the last hour on the main branch
58
- git fetch origin main --no-tags --shallow-since="$(( $(date +%s) - 3600 ))"
59
- git switch main
60
- VERSION_BUMP_COMMIT="$(git log --format='%H' --author='OSBotify' --grep 'Update version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}')"
72
+ git fetch origin \
73
+ staging \
74
+ ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }} \
75
+ ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }} \
76
+ --no-tags
77
+ --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}
61
78
62
- # Cherry-pick it to staging
79
+ - name : Cherry-pick the version-bump to staging
80
+ run : |
63
81
git switch staging
64
- git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs "$VERSION_BUMP_COMMIT"
82
+ git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }}
65
83
66
84
- name : Cherry-pick the merge commit of target PR
67
85
id : cherryPick
68
86
run : |
69
- if ! git rev-parse --verify ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }} 2>/dev/null; then
70
- echo "Merge commit of PR #${{ github.event.inputs.PULL_REQUEST_NUMBER }} (${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}) not found, fetching it now..."
71
- git fetch origin ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }} --no-tags --depth=1
72
- fi
73
-
74
87
echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}"
75
88
if git cherry-pick -S -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then
76
89
echo "🎉 No conflicts! CP was a success, PR can be automerged 🎉"
0 commit comments