@@ -38,10 +38,55 @@ jobs:
3838 git push origin "${{ github.event.inputs.to }}"
3939 cd ..
4040
41+ - name : Force merge to_base branch excluding tidb-cloud folder
42+ run : |
43+ cd docs
44+ git config user.name github-actions
45+ git config user.email github-actions@github.com
46+
47+ # Fetch the to_base branch
48+ git fetch origin "${{ github.event.inputs.to_base }}"
49+
50+ # Simple and reliable approach: merge everything first, then restore tidb-cloud
51+
52+ # Store the current target branch state before merge
53+ TARGET_BRANCH_HEAD=$(git rev-parse HEAD)
54+
55+ # Create a temporary branch from to_base
56+ git checkout -b temp-merge-branch "origin/${{ github.event.inputs.to_base }}"
57+
58+ # Switch back to target branch
59+ git checkout "${{ github.event.inputs.to }}"
60+
61+ # Merge the temporary branch with allow-unrelated-histories
62+ git merge temp-merge-branch --no-edit --allow-unrelated-histories -X theirs
63+
64+ # After merge, restore tidb-cloud folder from the original target branch state
65+ # Use the stored commit hash to restore the original tidb-cloud folder
66+ git checkout $TARGET_BRANCH_HEAD -- tidb-cloud/ || true
67+
68+ # If there are any conflicts in tidb-cloud, resolve them by keeping the target branch version
69+ git add tidb-cloud/ || true
70+
71+ # Clean up temporary branch
72+ git branch -D temp-merge-branch
73+
74+ # Get the latest filterCloudInitFiles.js from master branch
75+ git fetch origin master
76+ git checkout origin/master -- scripts/filterCloudInitFiles.js || true
77+
78+ # Push the changes
79+ git push origin "${{ github.event.inputs.to }}"
80+ cd ..
81+
4182 - name : Update latest_translation_commit.json
4283 run : |
4384 cd docs
44- echo '{"target":"${{ github.event.inputs.to_base }}","sha":""}' > latest_translation_commit.json
85+ # Get the latest commit SHA from to_base branch
86+ TO_BASE_SHA=$(git rev-parse origin/${{ github.event.inputs.to_base }})
87+ echo '{"target":"${{ github.event.inputs.to_base }}","sha":"'$TO_BASE_SHA'"}' > latest_translation_commit.json
88+ git config user.name github-actions
89+ git config user.email github-actions@github.com
4590 git add latest_translation_commit.json
4691 git commit -m "ci: update latest_translation_commit.json for ${{ github.event.inputs.to_base }}"
4792 git push origin "${{ github.event.inputs.to }}"
60105 export GH_TOKEN=${{github.token}}
61106 cd docs
62107 npm i
63- node scripts/filterUpdateFiles .js --cloud --init
108+ node scripts/filterCloudInitFiles .js
64109 tree tmp
65110 cd ..
66111
0 commit comments